Reputation: 1576
I have noticed a strange issue after upgrading the embedded V8 library from 3.28.4 to 6.1.534.47 (same as in current node.js 8.9.1). I have some code that dispatches events to JavaScript code (basically comes down to calling v8::Function::Call()
). This runs fine thousands of times, but eventually v8::Function::Call()
does not return, hanging in v8::internal::Runtime_TryInstallOptimizedCode()
.
Here's a stack trace:
frame #0: 0x0000000104f43cfc libv8.dylib`v8::internal::Runtime_TryInstallOptimizedCode(int, v8::internal::Object**, v8::internal::Isolate*) [inlined] v8::internal::__RT_impl_Runtime_TryInstallOptimizedCode(v8::internal::Arguments, v8::internal::Isolate*) at runtime-compiler.cc:374 [opt]
frame #1: 0x0000000104f43cd5 libv8.dylib`v8::internal::Runtime_TryInstallOptimizedCode(args_length=1, args_object=0x0000700001d1a0f0, isolate=0x000000010182d200) at runtime-compiler.cc:371 [opt]
frame #2: 0x000028715ea040bd
frame #3: 0x000028715ea15b12
frame #4: 0x000028715ea12cf0
frame #5: 0x000028715eadea2d
frame #6: 0x0000000104cb5ba3 libv8.dylib`v8::internal::(anonymous namespace)::Invoke(isolate=0x000000010182d2c8, is_construct=<unavailable>, target=<unavailable>, receiver=<unavailable>, argc=1, args=0x0000700001d1ad10, new_target=<unavailable>, message_handling=<unavailable>) at execution.cc:145 [opt]
frame #7: 0x0000000104cb58cc libv8.dylib`v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [inlined] v8::internal::(anonymous namespace)::CallInternal(message_handling=kReport) at execution.cc:181 [opt]
frame #8: 0x0000000104cb585d libv8.dylib`v8::internal::Execution::Call(isolate=0x000000010182d200, callable=Handle<v8::internal::Object> @ r12, receiver=<unavailable>, argc=1, argv=0x0000700001d1ad10) at execution.cc:191 [opt]
frame #9: 0x0000000104984d80 libv8.dylib`v8::Function::Call(this=0x000000010281fa50, context=<unavailable>, recv=<unavailable>, argc=1, argv=0x0000700001d1ad10) at api.cc:5343 [opt]
frame #10: 0x0000000104849c01 libPocoJSCored.1.dylib`Poco::JS::Core::JSExecutor::callInContext(this=0x0000000102029a00, jsObject=0x0000000100e64458, method="valueChanged", argc=1, argv=0x0000700
Observed this on both macOS 10.12 with Clang/Apple LLVM 9.0 and Ubuntu 17.10 with GCC 7.2.
Any ideas?
Upvotes: 1
Views: 435
Reputation: 40561
V8 developer here. Please file a bug on bugs.chromium.org/p/v8.
Are you doing anything funky with threads?
Do you have a repro you can share?
If you run with --trace-opt, what are the last lines of output before it hangs?
Can you compile in Debug mode and run in a debugger to see where exactly it hangs? (An obvious guess would be waiting for output_queue_mutex_
in OptimizingCompileDispatcher::InstallOptimizedFunctions()
, but I don't see how a deadlock on that mutex could happen, so before barking up the wrong tree, it would be nice to be sure what precisely the issue is.)
Upvotes: 2