Skip to content
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

Fatal Error when attaching debugger when certain node modules are loaded #17496

Closed
BasKiers opened this issue Dec 6, 2017 · 3 comments
Closed
Labels
inspector Issues and PRs related to the V8 inspector protocol

Comments

@BasKiers
Copy link

BasKiers commented Dec 6, 2017

  • Version: v8.9.2
  • Platform: Darwin MacBook-Pro.local 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 x86_64
  • Subsystem:

In a (quite large) project I had trouble attaching the debugger when starting the inspector from code (by using the inspector module). Right after connecting I receive a fatal error from nodejs. Now I've isolated the crash as much as I could to the i18next module so it can be reproduced. However this is not the only source of this crash since commenting this out will also produce this crash when the inspector is started in a later stage of the code (after other modules are required).

The crash is the following:

FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope
 1: node::Abort() [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
 3: v8::Utils::ReportApiFailure(char const*, char const*) [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
 4: v8::internal::HandleScope::Extend(v8::internal::Isolate*) [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
 5: v8::HandleScope::CreateHandle(v8::internal::Isolate*, v8::internal::Object*) [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
 6: node::inspector::Agent::EnableAsyncHook() [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
 7: v8_inspector::V8Debugger::setAsyncCallStackDepth(v8_inspector::V8DebuggerAgentImpl*, int) [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
 8: v8_inspector::V8DebuggerAgentImpl::setAsyncCallStackDepth(int) [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
 9: v8_inspector::protocol::Debugger::DispatcherImpl::setAsyncCallStackDepth(int, std::__1::unique_ptr<v8_inspector::protocol::DictionaryValue, std::__1::default_delete<v8_inspector::protocol::DictionaryValue> >, v8_inspector::protocol::ErrorSupport*) [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
10: v8_inspector::protocol::Debugger::DispatcherImpl::dispatch(int, v8_inspector::String16 const&, std::__1::unique_ptr<v8_inspector::protocol::DictionaryValue, std::__1::default_delete<v8_inspector::protocol::DictionaryValue> >) [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
11: v8_inspector::protocol::UberDispatcher::dispatch(std::__1::unique_ptr<v8_inspector::protocol::Value, std::__1::default_delete<v8_inspector::protocol::Value> >) [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
12: v8_inspector::V8InspectorSessionImpl::dispatchProtocolMessage(v8_inspector::StringView const&) [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
13: node::inspector::InspectorIo::DispatchMessages() [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
14: uv__async_io [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
15: uv__io_poll [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
16: uv_run [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
17: node::Start(v8::Isolate*, node::IsolateData*, int, char const* const*, int, char const* const*) [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
18: node::Start(uv_loop_s*, int, char const* const*, int, char const* const*) [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
19: node::Start(int, char**) [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
20: start [/Users/[user]/.nvm/versions/node/v8.9.2/bin/node]
21: 0x2

I've created a repository to enable reproducing the crash here: https://github.com/athombv/node-inspector-createhandle-crash

@mscdex mscdex added inspector Issues and PRs related to the V8 inspector protocol v8.x and removed v8.x labels Dec 7, 2017
bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Dec 7, 2017
Fix a regression that was introduced in commit 5886e20 ("inspector:
track async stacks when necessary") and that I overlooked during review:
the persistent handle with the callback must be rematerialized *after*
the `v8::HandleScope` is created, not before.

Apparently `test/sequential/test-inspector-async-call-stack.js` has
no test coverage for this scenario and I'm out of good ideas on how
to create a concise and reliable test case.

Fixes: nodejs#17496
@bnoordhuis
Copy link
Member

Thanks Bas, good bug report. Fix in #17539.

@BasKiers
Copy link
Author

BasKiers commented Dec 8, 2017

Hi,

Thanks for fixing it so quickly!

@Vovka19
Copy link

Vovka19 commented Dec 9, 2017

Thanks!

  • [ ]

MylesBorins pushed a commit that referenced this issue Dec 12, 2017
Fix a regression that was introduced in commit 5886e20 ("inspector:
track async stacks when necessary") and that I overlooked during review:
the persistent handle with the callback must be rematerialized *after*
the `v8::HandleScope` is created, not before.

Apparently `test/sequential/test-inspector-async-call-stack.js` has
no test coverage for this scenario and I'm out of good ideas on how
to create a concise and reliable test case.

Fixes: #17496
PR-URL: #17539
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
MylesBorins pushed a commit that referenced this issue Dec 12, 2017
Fix a regression that was introduced in commit 5886e20 ("inspector:
track async stacks when necessary") and that I overlooked during review:
the persistent handle with the callback must be rematerialized *after*
the `v8::HandleScope` is created, not before.

Apparently `test/sequential/test-inspector-async-call-stack.js` has
no test coverage for this scenario and I'm out of good ideas on how
to create a concise and reliable test case.

Fixes: #17496
PR-URL: #17539
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
gibfahn pushed a commit that referenced this issue Dec 20, 2017
Fix a regression that was introduced in commit 5886e20 ("inspector:
track async stacks when necessary") and that I overlooked during review:
the persistent handle with the callback must be rematerialized *after*
the `v8::HandleScope` is created, not before.

Apparently `test/sequential/test-inspector-async-call-stack.js` has
no test coverage for this scenario and I'm out of good ideas on how
to create a concise and reliable test case.

Fixes: #17496
PR-URL: #17539
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
gibfahn pushed a commit that referenced this issue Dec 20, 2017
Fix a regression that was introduced in commit 5886e20 ("inspector:
track async stacks when necessary") and that I overlooked during review:
the persistent handle with the callback must be rematerialized *after*
the `v8::HandleScope` is created, not before.

Apparently `test/sequential/test-inspector-async-call-stack.js` has
no test coverage for this scenario and I'm out of good ideas on how
to create a concise and reliable test case.

Fixes: #17496
PR-URL: #17539
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inspector Issues and PRs related to the V8 inspector protocol
Projects
None yet
Development

No branches or pull requests

4 participants