-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Taking snapshot crashes Worker thread when taken during bootstrap #37069
Comments
The crash comes from this DCHECK: node/deps/v8/src/objects/scope-info.cc Line 938 in 258d77a
|
/cc @nodejs/workers |
@targos Thanks. You brought to my attention that for some reason |
Hi, this problem also affects node v16 |
I have The same issue in the main process of nodejs. I do not use worker threads but when I try to create a heap snapshot on windows in nodejs 14.17.3 the process crashes with this stack :000> kp
# Child-SP RetAddr Call Site
00 (Inline Function) --------`-------- node!v8::internal::TaggedImpl<1,unsigned __int64>::operator==(void) [c:\ws\deps\v8\src\objects\tagged-impl.h @ 48]
01 (Inline Function) --------`-------- node!v8::internal::Object::IsUndefined(void) [c:\ws\deps\v8\src\objects\objects-inl.h @ 117]
02 (Inline Function) --------`-------- node!v8::internal::HeapObject::IsUndefined(void) [c:\ws\deps\v8\src\objects\objects-inl.h @ 117]
03 (Inline Function) --------`-------- node!v8::internal::HeapObject::IsUndefined(void)+0x9 [c:\ws\deps\v8\src\objects\objects-inl.h @ 117]
04 (Inline Function) --------`-------- node!v8::internal::Context::has_extension(void)+0x2a [c:\ws\deps\v8\src\objects\contexts-inl.h @ 99]
05 00000063`3ad1e760 00007ff6`26dffbcf node!v8::internal::V8HeapExplorer::ExtractContextReferences(class v8::internal::HeapEntry * entry = 0x0000024e`53f81810, class v8::internal::Context context = class v8::internal::Context)+0x190 [c:\ws\deps\v8\src\profiler\heap-snapshot-generator.cc @ 1000]
06 00000063`3ad1e7e0 00007ff6`26e01a5a node!v8::internal::V8HeapExplorer::ExtractReferences(class v8::internal::HeapEntry * entry = 0x0000024e`53f81810, class v8::internal::HeapObject obj = class v8::internal::HeapObject)+0x4df [c:\ws\deps\v8\src\profiler\heap-snapshot-generator.cc @ 811]
07 00000063`3ad1e830 00007ff6`26e006e0 node!v8::internal::V8HeapExplorer::IterateAndExtractReferences(class v8::internal::HeapSnapshotGenerator * generator = <Value unavailable error>)+0x32a [c:\ws\deps\v8\src\profiler\heap-snapshot-generator.cc @ 1517]
08 (Inline Function) --------`-------- node!v8::internal::HeapSnapshotGenerator::FillReferences(void)+0xc [c:\ws\deps\v8\src\profiler\heap-snapshot-generator.cc @ 2094]
09 00000063`3ad1e9d0 00007ff6`26e07de0 node!v8::internal::HeapSnapshotGenerator::GenerateSnapshot(void)+0x120 [c:\ws\deps\v8\src\profiler\heap-snapshot-generator.cc @ 2058]
0a 00000063`3ad1ea40 00007ff6`2692af85 node!v8::internal::HeapProfiler::TakeSnapshot(class v8::ActivityControl * control = 0x00000000`00000000, class v8::HeapProfiler::ObjectNameResolver * resolver = 0x00000000`00000000, bool treat_global_objects_as_roots = true)+0x80 [c:\ws\deps\v8\src\profiler\heap-profiler.cc @ 75]
0b 00000063`3ad1ec50 00007ff6`2716f2df node!node::heap::CreateHeapSnapshotStream(class v8::FunctionCallbackInfo<v8::Value> * args = 0x00000063`3ad1eca0)+0x75 [c:\ws\src\heap_utils.cc @ 359]
0c 00000063`3ad1ec80 00007ff6`2716e874 node!v8::internal::FunctionCallbackArguments::Call(class v8::internal::CallHandlerInfo handler = <Value unavailable error>)+0x14f [c:\ws\deps\v8\src\api\api-arguments-inl.h @ 159]
0d 00000063`3ad1ed20 00007ff6`2716eb68 node!v8::internal::`anonymous namespace'::HandleApiCallHelper<0>(class v8::internal::Isolate * isolate = 0x0000024e`509f1d40, class v8::internal::Handle<v8::internal::HeapObject> function = class v8::internal::Handle<v8::internal::HeapObject>, class v8::internal::Handle<v8::internal::HeapObject> new_target = class v8::internal::Handle<v8::internal::HeapObject>, class v8::internal::Handle<v8::internal::FunctionTemplateInfo> fun_data = class v8::internal::Handle<v8::internal::FunctionTemplateInfo>, class v8::internal::Handle<v8::internal::Object> receiver = class v8::internal::Handle<v8::internal::Object>, class v8::internal::BuiltinArguments * args = 0x00000063`3ad1ee80)+0x254 [c:\ws\deps\v8\src\builtins\builtins-api.cc @ 113]
0e 00000063`3ad1ee40 00007ff6`2716e9b3 node!v8::internal::Builtin_Impl_HandleApiCall(class v8::internal::BuiltinArguments * args = 0x00000063`3ad1eef0, class v8::internal::Isolate * isolate = 0x0000024e`509f1d40)+0x108 [c:\ws\deps\v8\src\builtins\builtins-api.cc @ 141]
0f 00000063`3ad1eed0 00007ff6`2724b35d node!v8::internal::Builtin_HandleApiCall(int args_length = <Value unavailable error>, unsigned int64 * args_object = <Value unavailable error>, class v8::internal::Isolate * isolate = <Value unavailable error>)+0x33 [c:\ws\deps\v8\src\builtins\builtins-api.cc @ 129]
10 00000063`3ad1ef10 00007ff6`271e3722 node!Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit(void)+0x3d [c:\ws\out\Release\obj\v8_snapshot\embedded.S @ 14831]
11 00000063`3ad1ef60 00007ff6`271e3722 node!Builtins_InterpreterEntryTrampoline(void)+0xc2 [c:\ws\out\Release\obj\v8_snapshot\embedded.S @ 1225]
12 00000063`3ad1efc8 00007ff6`271e3722 node!Builtins_InterpreterEntryTrampoline(void)+0xc2 [c:\ws\out\Release\obj\v8_snapshot\embedded.S @ 1225]
13 00000063`3ad1f030 00007ff6`271dd359 node!Builtins_InterpreterEntryTrampoline(void)+0xc2 [c:\ws\out\Release\obj\v8_snapshot\embedded.S @ 1225]
14 00000063`3ad1f0b0 000000d9`882d7aee node!Builtins_ArgumentsAdaptorTrampoline(void)+0xb9 [c:\ws\out\Release\obj\v8_snapshot\embedded.S @ 343]
15 00000063`3ad1f0f0 000000d9`882d45e0 0x000000d9`882d7aee
16 00000063`3ad1f1a0 00007ff6`271e13de 0x000000d9`882d45e0
17 00000063`3ad1f1f8 00007ff6`271e0fcc node!Builtins_JSEntryTrampoline(void)+0x5e [c:\ws\out\Release\obj\v8_snapshot\embedded.S @ 934]
18 00000063`3ad1f228 00007ff6`270b0be2 node!Builtins_JSEntry(void)+0xcc [c:\ws\out\Release\obj\v8_snapshot\embedded.S @ 895]
19 (Inline Function) --------`-------- node!v8::internal::GeneratedCode<unsigned __int64,unsigned __int64,unsigned __int64,unsigned __int64,unsigned __int64,__int64,unsigned __int64 * *>::Call(int64 <args_4> = <Value unavailable error>)+0x16 [c:\ws\deps\v8\src\execution\simulator.h @ 142]
1a 00000063`3ad1f340 00007ff6`270b044f node!v8::internal::`anonymous namespace'::Invoke(class v8::internal::Isolate * isolate = 0x00000063`3ad1ef80, struct v8::internal::`anonymous-namespace'::InvokeParams * params = 0x000001ff`c16004a1)+0x482 [c:\ws\deps\v8\src\execution\execution.cc @ 369]
1b 00000063`3ad1f450 00007ff6`2719c567 node!v8::internal::Execution::Call(class v8::internal::Isolate * isolate = 0x0000024e`509f1d40, class v8::internal::Handle<v8::internal::Object> callable = <Value unavailable error>, class v8::internal::Handle<v8::internal::Object> receiver = <Value unavailable error>, int argc = 0n1, class v8::internal::Handle<v8::internal::Object> * argv = 0x00000063`3ad1f680)+0xbf [c:\ws\deps\v8\src\execution\execution.cc @ 463]
1c 00000063`3ad1f520 00007ff6`2694364c node!v8::Function::Call(class v8::Local<v8::Context> context = <Value unavailable error>, class v8::Local<v8::Value> recv = class v8::Local<v8::Value>, int argc = 0n1, class v8::Local<v8::Value> * argv = 0x00000063`3ad1f680)+0x267 [c:\ws\deps\v8\src\api\api.cc @ 4875]
1d 00000063`3ad1f650 00007ff6`269a53c4 node!node::Environment::RunTimers(struct uv_timer_s * handle = 0x0000024e`50a0bd78)+0x1cc [c:\ws\src\env.cc @ 841]
1e 00000063`3ad1f790 00007ff6`269a1b42 node!uv__run_timers(struct uv_loop_s * loop = 0x00007ff6`29eecd70)+0x74 [c:\ws\deps\uv\src\timer.c @ 178]
1f 00000063`3ad1f7c0 00007ff6`268a2bf5 node!uv_run(struct uv_loop_s * loop = 0x00007ff6`29eecd70, uv_run_mode mode = UV_RUN_DEFAULT (0n0))+0xc2 [c:\ws\deps\uv\src\win\core.c @ 609]
20 00000063`3ad1f840 00007ff6`269170f7 node!node::NodeMainInstance::Run(void)+0x155 [c:\ws\src\node_main_instance.cc @ 132]
21 00000063`3ad1f8d0 00007ff6`2677679c node!node::Start(int argc = <Value unavailable error>, char ** argv = <Value unavailable error>)+0x137 [c:\ws\src\node.cc @ 1102]
22 00000063`3ad1fa60 00007ff6`27740de8 node!wmain(int argc = 0n4, wchar_t ** wargv = 0x0000024e`5099da40)+0x1cc [c:\ws\src\node_main.cc @ 87]
23 (Inline Function) --------`-------- node!invoke_main(void)+0x22 [d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 90]
24 00000063`3ad1fc20 00007ffd`0c4f7034 node!__scrt_common_main_seh(void)+0x10c [d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288]
25 00000063`3ad1fc60 00007ffd`0c8a2651 kernel32!BaseThreadInitThunk+0x14
26 00000063`3ad1fc90 00000000`00000000 ntdll!RtlUserThreadStart+0x21 |
Possible duplicate: Red Hat Bugzilla #1992976 |
I don't know if it's related but we've seen one instance of a crash in
|
Not sure if it's helpful, but me nor anyone else on my team is able to take heap snapshots in our app in node 14.16+ (up to latest node 14). Attached the crashlog. We're able to reliably reproduce it. |
What steps will reproduce the bug?
Run this code with a debug build of node:
How often does it reproduce? Is there a required condition?
Every time with a debug build.
What is the expected behavior?
To not crash.
What do you see instead?
The process aborts. Here is the backtrace from v14.15.4 using
gdb
:For some reason
lldb
gives a drastically different backtrace:Additional information
This does not crash in v12.20.1.
I've also written a native module and called the C++ API directly from both the same thread and using an interrupt from a different thread. As long as the call is made during
node::worker::Worker::StartThread()
the process will crash.It's also possible to crash the process when taking the snapshot from a different thread. Here's an example:
It also crashes if the
inspector
API is used:The text was updated successfully, but these errors were encountered: