I filed a bug here: https://code.google.com/p/v8/issues/detail?id=3892

On Monday, February 16, 2015 at 7:36:15 AM UTC+1, fal...@chromium.org wrote:
>
> (Sorry that this post may be Blink-specific)
> I'm having trouble using TerminateExecution to kill a Service Worker 
> that's in a loop like this:
>   while (true) { console.log('hi'); }
>
> Loop bodies like {} and [ self.location; } work as expected. It seems 
> specific to console.log, and it's racy: most of the time it fails, but 
> occasionally it works. I think the termination exception may be eaten in 
> the following stack:
>
> #3  0x00007fc7ee66f0b7 in v8::internal::Execution::TryCall (func=..., 
> receiver=..., argc=0, args=0x0, exception_out=<optimized out>) at 
> ../../v8/src/execution.cc:207
> #4  0x00007fc7ee8bcdce in v8::internal::Script::GetNameOrSourceURL 
> (script=...) at ../../v8/src/objects.cc:10142
> #5  0x00007fc7ee802885 in 
> v8::internal::CaptureStackTraceHelper::NewStackFrameObject 
> (this=0x7fc7cfc2ad70, fun=..., code=..., pc=<optimized out>, 
> is_constructor=false) at ../../v8/src/isolate.cc:551
> #6  0x00007fc7ee801bb1 in v8::internal::Isolate::CaptureCurrentStackTrace 
> (this=0x3c84dc05c020, frame_limit=<optimized out>, options=<optimized out>) 
> at ../../v8/src/isolate.cc:654
>
> TryCall has a |is_termination| variable, which looks like it causes a 
> "rethrow" of TerminateExecution, but it's never set to true because 
> |exception_out| is NULL. However, just changing the function to rethrow 
> did not appear to solve the issue.
>
> I wonder if GetNameOrSourceURL or someone else needs to detect the 
> exception. When termination works, I can capture a stack trace (below), 
> which looks like exception is "caught" within 
> V8ScriptRunner:runCompiledScript, and ultimately we can leave V8. But when 
> it doesn't work, it looks like it's "caught" in a mystery stack that starts 
> with blink::ConsoleBaseV8Internal::logMethodCallback, and we ultimately 
> loop forever calling that method.
>
> More context is at: https://codereview.chromium.org/912753002/
>
> (Stack trace from a trial that works)
> #0  v8::internal::Isolate::PropagatePendingExceptionToExternalTryCatch 
> (this=0x3c84dbf4f020) at ../../v8/src/isolate.cc:1955
> #1  0x00007fc7ee807a59 in 
> v8::internal::Isolate::OptionalRescheduleException (this=0x3c84dbf4f020, 
> is_bottom_call=true) at ../../v8/src/isolate.cc:1447
> #2  0x00007fc7ee45351e in v8::Script::Run (this=<optimized out>) at 
> ../../v8/src/api.cc:1515
> #3  0x00007fc7e34165cb in blink::V8ScriptRunner::runCompiledScript 
> (isolate=0x3c84dbf4f020, script=..., context=0x1e1b9e050fa8) at 
> ../../third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp:400
> #4  0x00007fc7e342aaf1 in blink::WorkerScriptController::evaluate 
> (this=0x3c84dbff6230, script="// oninstall = function() {\n  while (true) 
> {\n    console.log('i am still alive');\n  }\n// }\n",
>     fileName="http://localhost:8009/resources/fetch-forever-worker.js";, 
> scriptStartPosition=...) at 
> ../../third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.cpp:217
>
> (Stack trace from a trial that fails)
> #0  v8::internal::Isolate::PropagatePendingExceptionToExternalTryCatch 
> (this=0x3c84dc05c020) at ../../v8/src/isolate.cc:1955
> #1  0x00007fc7ee807a59 in 
> v8::internal::Isolate::OptionalRescheduleException (this=0x3c84dc05c020, 
> is_bottom_call=true) at ../../v8/src/isolate.cc:1447
> #2  0x00007fc7ee66f184 in v8::internal::Execution::TryCall (func=..., 
> receiver=..., argc=<optimized out>, args=<optimized out>, 
> exception_out=<optimized out>) at ../../v8/src/execution.cc:221
> #3  0x00007fc7ee8bcdce in v8::internal::Script::GetNameOrSourceURL 
> (script=...) at ../../v8/src/objects.cc:10142
> #4  0x00007fc7ee802885 in 
> v8::internal::CaptureStackTraceHelper::NewStackFrameObject 
> (this=0x7fc7cfc2ad70, fun=..., code=..., pc=<optimized out>, 
> is_constructor=false) at ../../v8/src/isolate.cc:551
> #5  0x00007fc7ee801bb1 in v8::internal::Isolate::CaptureCurrentStackTrace 
> (this=0x3c84dc05c020, frame_limit=<optimized out>, options=<optimized out>) 
> at ../../v8/src/isolate.cc:654
> #6  0x00007fc7ee461052 in v8::StackTrace::CurrentStackTrace 
> (isolate=0x3c84dc05c020, frame_limit=-290331648, options=<optimized out>) 
> at ../../v8/src/api.cc:2154
> #7  0x00007fc7e339541d in blink::createScriptCallStack (maxStackSize=1, 
> emptyStackIsAllowed=true) at 
> ../../third_party/WebKit/Source/bindings/core/v8/ScriptCallStackFactory.cpp:111
> #8  0x00007fc7e3395514 in blink::createScriptCallStackForConsole 
> (maxStackSize=200, emptyStackIsAllowed=true) at 
> ../../third_party/WebKit/Source/bindings/core/v8/ScriptCallStackFactory.cpp:125
> #9  0x00007fc7e476f045 in blink::ConsoleMessage::collectCallStack 
> (this=0x1e1b9e245c30) at 
> ../../third_party/WebKit/Source/core/inspector/ConsoleMessage.cpp:185
> #10 0x00007fc7e476f69f in blink::ConsoleMessageStorage::reportMessage 
> (this=0x1e1b9e0cbf50, context=0x1e1b9e050fa8, prpMessage=...) at 
> ../../third_party/WebKit/Source/core/inspector/ConsoleMessageStorage.cpp:25
> #11 0x00007fc7e49ccc8a in 
> blink::WorkerGlobalScope::addMessageToWorkerConsole (this=0x1e1b9e050f10, 
> consoleMessage=...) at 
> ../../third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp:309
> #12 0x00007fc7e49ccb71 in blink::WorkerGlobalScope::addConsoleMessage 
> (this=0x1e1b9e050f10, prpConsoleMessage=...) at 
> ../../third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp:303
> #13 0x00007fc7e49c82af in blink::WorkerConsole::reportMessageToConsole 
> (this=0x1e1b9e0dd390, consoleMessage=...) at 
> ../../third_party/WebKit/Source/core/workers/WorkerConsole.cpp:59
> #14 0x00007fc7e46d4986 in blink::ConsoleBase::internalAddMessage 
> (this=0x1e1b9e0dd390, type=blink::LogMessageType, 
> level=blink::LogMessageLevel, scriptState=0x1e1b9e0cce98, 
> scriptArguments=...,
>     acceptNoArguments=false, printTrace=false) at 
> ../../third_party/WebKit/Source/core/frame/ConsoleBase.cpp:228
> #15 0x00007fc7e46d4b19 in blink::ConsoleBase::log (this=0x1e1b9e0dd390, 
> scriptState=0x1e1b9e0cce98, arguments=...) at 
> ../../third_party/WebKit/Source/core/frame/ConsoleBase.cpp:64
> #16 0x00007fc7e359f4d2 in blink::ConsoleBaseV8Internal::logMethod 
> (info=...) at gen/blink/bindings/core/v8/V8ConsoleBase.cpp:86
> #17 0x00007fc7e359ad64 in blink::ConsoleBaseV8Internal::logMethodCallback 
> (info=...) at gen/blink/bindings/core/v8/V8ConsoleBase.cpp:92
> #18 0x00000f1dd5059484 in ?? ()
> #19 0x00007fc7cfc2b4c0 in ?? ()
> #20 0x00007fc7cfc2b4f8 in ?? ()
> #21 0x0000000000000001 in ?? ()
> #22 0x0000000000000000 in ?? ()
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to