On 18 November 2012 21:56, Paul Harris <[email protected]> wrote: > Hi, > > I run my JS code in a v8 Isolate, > > In another thread, I cancel the running JS program at any time using > V8::TerminateExecution(isolate); > > As I understand it, the TerminateExecution() raises an exception in the > running isolate/context, which causes the running JS script to fail and > stop. > > If I run a tight while loop, like so: > while (1) { > print('hello'); > } > > which calls my Native_Print() C++ function, often the native function is > running when things start to fail. > eg, the first time I call > String::New("whatnot"); > it returns an empty handle because of the terminate exception. > > When my Native_Print() detects the empty handle, it tries to throw an > exception, which involves generating a new exception message, which calls > String::New() > > It seems that the second call to a V8 function (in this case, ToString()) > triggers a fatal crash, like so: > # > # Fatal error in ../src/api.cc, line 2325 > # CHECK(!(isolate)->external_caught_exception()) failed > # > > > I was able to work-around this problem by checking > V8::IsExecutionTerminating() in my native function, BUT now I am hitting > the same problem in the V8 core. > > > I am running a remote debugger (the Eclipse one). I start the script, > pause it using the 'debugger;' command, then connect to it with Eclipse. > > THEN, I cancel the execution using V8::TerminateExecution() via the second > thread method within the program. > The script is still suspended and connected to the debugger. > > THEN, in Eclipse, I click Step/continue/anything, and the host program > crashes with the same Fatal error. > > > Am I terminating the javascript incorrectly? > Any ideas? > > thanks very much, > Paul > >
I had thought about calling DisableAgent() before I call TerminateExecution, but DisableAgent uses CurrentIsolate() so therefore it can't be used in a different thread from the running process... -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
