Quantcast
Channel: ClearScript
Viewing all 2297 articles
Browse latest View live

New Post: Potential Stackoverflow on Azure Web Apps

0
0
Hello,

The error message you're seeing indicates the following:
  1. Script execution ended prematurely due to an uncaught script exception.
  2. Converting the thrown object to a string yielded an empty string.
Because of (2), no error message is available; hence "Unknown error". Additionally, in our own testing, we've observed V8 throwing such an object only during stack overflow recovery; hence "potential stack overflow detected".

However, more recently we found that simply throwing an empty string (or any object whose toString method returns an empty string) produces the same result. That's a ClearScript bug we need to fix, at least to enable stack traces in such situations.

In the meantime, is it possible that your script throws such an object? Consider adding a try..catch block to detect that. If not, you may actually be hitting a stack overflow. Are you specifying stack usage limits for your V8 runtimes?

Good luck!

New Post: Potential Stackoverflow on Azure Web Apps

0
0
Hi

Thanks for the prompt reply. We used to get the error occurring in various execution paths but after upgrades and refinements (such as tuning the reuse of runtimes and engines, invoking garbage collection, precompiling scripts) it has narrowed down to one scenario/piece of code:
(typeof _myVariable !== 'undefined')
This will have been run before every execution of javascript code across all our requests hence the fact that it's seemingly random given it only happens once in a while. We could indeed try...catch and retry or even dispose the engine and initialise a new one but only want to do that as a last resort (e.g. if that's the nature of the v8 engine). Other options could be to change the above code if it's causing the condition within v8... but it all seems very odd as we've only ever seen it on azure apart from when i artificially created it by setting the stack usage limit to a low figure - otherwise we don't set stack usage limits.

Thanks once again.
James

New Post: Potential Stackoverflow on Azure Web Apps

0
0
Hi James,

Interesting. Are you saying that the JavaScript expression above is somehow responsible for the issues you're seeing?

In any case, try..catch might be a low-cost way to diagnose the problem. It won't catch true stack overflows, but it should be able to find cases of empty strings (or similar objects) being thrown, and it shouldn't affect your application's performance.

Consider also that true stack overflows aren't uncommon. ClearScript can build up large stacks, especially with nested script execution, and the default stack allocation is typically only 1 MB.

Cheers!

Created Unassigned: [Feature] Support for .Net CoreClr [99]

0
0
I'm not sure how feasible this is considering dependencies like V8 but it would be great to have even partial support for [.Net CoreClr](https://github.com/dotnet/coreclr)

Edited Unassigned: [FEATURE] Support for .Net CoreClr [99]

0
0
I'm not sure how feasible this is considering dependencies like V8 but it would be great to have even partial support for [.Net CoreClr](https://github.com/dotnet/coreclr)

Edited Feature: [FEATURE] Support for .Net CoreClr [99]

0
0
I'm not sure how feasible this is considering dependencies like V8 but it would be great to have even partial support for [.Net CoreClr](https://github.com/dotnet/coreclr)

Edited Feature: [FEATURE] Support for .Net CoreClr [99]

0
0
I'm not sure how feasible this is considering dependencies like V8 but it would be great to have even partial support for [.Net CoreClr](https://github.com/dotnet/coreclr)

New Post: convert arguments to c# array?

0
0
hi,

how can i convert the js arguments object to an c# array?

New Post: convert arguments to c# array?

0
0
Hi furesoft,

Here's a sample that sets up a script-callable function for converting any array-like JavaScript object to a .NET array:
engine.Script.toClrArray = new Func<dynamic, object>(obj => {
    var result = newobject[obj.length];
    for (var i = 0; i < result.Length; ++i)
        result[i] = obj[i];
    return result;
});
And here's how you might use it from script code:
engine.Execute(@"
    function MakeClrArray() {
        return toClrArray(arguments)
    };
    var foo = MakeClrArray(1, 2, 3, 'bar', Math.PI);
");
Good luck!

New Post: Potential Stackoverflow on Azure Web Apps

0
0
A quick related question - what happens if I dispose a V8Runtime instance then still try to use a V8Engine instance that was created from that runtime (then dispose it)?
Could this scenario cause the potential stackoverflow?
James

New Post: Potential Stackoverflow on Azure Web Apps

0
0
Hi James,

This scenario should be fine; that is, it shouldn't cause any issues. An active V8ScriptEngine maintains a strong reference to its associated (unmanaged) V8 runtime. Note that a script object only holds a weak reference to its unmanaged counterpart, so disposing its parent engine or runtime turns it into a "zombie".

Good luck!

New Post: Potential Stackoverflow on Azure Web Apps

0
0
Many many thanks - I checked and i wasn't disposing of the compiled script objects that each Runtime had compiled so am now explicitly disposing of them :)
So if the last V8Engine spawned from a managed runtime is disposed after the managed runtime has already been disposed, will the unmanaged runtime instance be destroyed/deallocated?

Regards
James

New Post: Potential Stackoverflow on Azure Web Apps

0
0
So if the last V8Engine spawned from a managed runtime is disposed after the managed runtime has already been disposed, will the unmanaged runtime instance be destroyed/deallocated?

Yes, it should. The managed engine and runtime are proxies for reference-counted unmanaged objects. Disposing or finalizing a proxy decrements its target's reference count, and the target is destroyed when its reference count reaches zero. Furthermore, the unmanaged engine holds an additional reference to its parent runtime, so the runtime will be kept alive as long as the engine remains active, regardless of whether a runtime proxy exists on the managed side.

Thanks!

New Post: Object is not a function error

0
0
Hi,

I Am trying to use global objects member within event handler, when event fired it throws exception "obj.PROCESSFAX is not a function". code is
var obj=new FaxProcessor.FaxProcess.Main();
var conncect=HotKeyNotifier.HotKeyPressed.connect(function(obj){
    obj.PROCESSFAX('sample.png');
}
does objects static member cause this error. works with other objects and outside of event handler.

Thanks and Regards
Praveen Kumar

New Post: Object is not a function error

0
0
Hello Praveen,

Given the code above, your event handler's obj parameter hides the global object with the same name. Could that be the problem?

Thanks!

New Post: MSVCR.dll is missing from your computer

0
0
What are the Visual C++ Redistributable Packages expectations? Is it a pre-requisite for all Apps that use ClearScript?

Our SDK (Class library developed using Visual Studio 2013) that references ClearScript.V8 v5.4.2.1 will be distributed to be used in winforms or wpf apps. A sample wpf app that uses our SDK works fine on my developer machine, but on copying the bin\debug folder to a windows 7 laptop, it see the following error
The program can't start because MSVCR120.dll is missing from your computer. Try reinstalling the program to fix this problem.
On searching the internet, there were pointers to get Visual C++ Redistributable Packages for Visual Studio 2013 installed on the target machine.

Couple of questions
  1. Wondering if I should ask our partners who create the Apps to add these redistributables to their deployment package?
  2. Is there any other way to distribute these missing dll's along with our SDK?

New Post: MSVCR.dll is missing from your computer

0
0
Hello!

Only ClearScript's V8 interface uses the Visual C++ libraries, so you don't need them if you're using JScript or VBScript.

Since these libraries are available as free downloads, you can either bundle them with your SDK or instruct your partners to download the latest versions, although they're likely to have them already if they use Visual Studio.

When it comes to end-user deployment, it usually makes sense to have the application package automate the installation of these libraries. See here for an overview of the available options.

Good luck!

New Post: Potential Stackoverflow on Azure Web Apps

0
0
Hi there
Thanks for that insight - that should mean that even under high load where we will spawn additional runtimes and engines we shouldn't have any zombie instances left lying around after disposing of all of them. Have tracked down further potential problematic usages of the runtime (finding a global variable that mocked the console and getting all the calls made to it) and waiting to see if the errors resurface - so far we haven't done a try...catch. Fingers crossed that's it. Cheers for your help so far.
James

Created Unassigned: Cannot create a file when that file already exists [100]

0
0

Clearscript 5.3.11.0 return error "Cannot create a file when that file already exists".

My project is an Windows application in C#, framework 4.5.
In the application each 1/2 seconds is called :

VBScriptEngine engine = new VBScriptEngine();
foreach (ParsedItem pi in _parsedItems) engine.AddHostObject(pi.Id, pi);
engine.Dispose();

The application is run in multiple instance (20 applications contemporary).
Sometimes in the log I get error "Cannot create a file when that file already exists".


Commented Unassigned: Cannot create a file when that file already exists [100]

0
0

Clearscript 5.3.11.0 return error "Cannot create a file when that file already exists".

My project is an Windows application in C#, framework 4.5.
In the application each 1/2 seconds is called :

VBScriptEngine engine = new VBScriptEngine();
foreach (ParsedItem pi in _parsedItems) engine.AddHostObject(pi.Id, pi);
engine.Dispose();

The application is run in multiple instance (20 applications contemporary).
Sometimes in the log I get error "Cannot create a file when that file already exists".


Comments: Hello! Can you provide more information? Why do you believe this is a ClearScript issue? A stack trace could be helpful. If you can't reproduce the issue in the debugger, try writing the entire exception (rather than just the message string) out to your log. Also, please consider switching to the latest version of ClearScript. The version you're using has known memory leaks among other issues. Thanks!
Viewing all 2297 articles
Browse latest View live




Latest Images