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

Exception after "break on start" causes hard crash #13438

Closed
seishun opened this issue Jun 3, 2017 · 2 comments · Fixed by #13455
Closed

Exception after "break on start" causes hard crash #13438

seishun opened this issue Jun 3, 2017 · 2 comments · Fixed by #13455
Labels
inspector Issues and PRs related to the V8 inspector protocol v8 engine Issues and PRs related to the V8 dependency.

Comments

@seishun
Copy link
Contributor

seishun commented Jun 3, 2017

  • Version: 8.0.0 and master
  • Platform: any?
  • Subsystem: debugger

debug.js:

foobar

Steps:

  1. Run node --inspect-brk debug.js
  2. Open "chrome://inspect" in Chrome
  3. Click "inspect" under "Target (v9.0.0-pre)"
  4. Click the "Resume script execution" button

Result:

C:\Users\Nikolai\Downloads\node>Release\node.exe --inspect-brk debug.js
Debugger listening on ws://127.0.0.1:9229/c746e04e-ed7d-4727-8a1d-ffe571f51968
For help see https://nodejs.org/en/docs/inspector
Debugger attached.
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
@seishun seishun added v8 engine Issues and PRs related to the V8 dependency. debugger labels Jun 3, 2017
@alex7kom
Copy link

alex7kom commented Jun 3, 2017

I've reproduced this on macOS 10.12.5

Debugger listening on ws://127.0.0.1:9229/2ed98bf7-17e4-4355-be86-7fa24cd2b63c
For help see https://nodejs.org/en/docs/inspector
Debugger attached.
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
 1: node::Abort() [/Users/alex7kom/.nvm/versions/node/v8.0.0/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/Users/alex7kom/.nvm/versions/node/v8.0.0/bin/node]
 3: v8::V8::ToLocalEmpty() [/Users/alex7kom/.nvm/versions/node/v8.0.0/bin/node]
 4: node::inspector::(anonymous namespace)::CallAndPauseOnStart(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/alex7kom/.nvm/versions/node/v8.0.0/bin/node]
 5: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/Users/alex7kom/.nvm/versions/node/v8.0.0/bin/node]
 6: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/alex7kom/.nvm/versions/node/v8.0.0/bin/node]
 7: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/alex7kom/.nvm/versions/node/v8.0.0/bin/node]
 8: 0x873b248437d
 9: 0x873b2650969
10: 0x873b264a823
[1]    15343 abort      node --inspect-brk debug.js

@bnoordhuis bnoordhuis added the inspector Issues and PRs related to the V8 inspector protocol label Jun 3, 2017
@seishun
Copy link
Contributor Author

seishun commented Jun 4, 2017

When breaking on start, this code is executed:

node/lib/module.js

Lines 566 to 567 in 16689e3

result = inspectorWrapper(compiledWrapper, this.exports, this.exports,
require, this, filename, dirname);

Which in turn calls this:

node/src/inspector_agent.cc

Lines 360 to 375 in 26ab769

void CallAndPauseOnStart(
const v8::FunctionCallbackInfo<v8::Value>& args) {
Environment* env = Environment::GetCurrent(args);
CHECK_GT(args.Length(), 1);
CHECK(args[0]->IsFunction());
std::vector<v8::Local<v8::Value>> call_args;
for (int i = 2; i < args.Length(); i++) {
call_args.push_back(args[i]);
}
env->inspector_agent()->PauseOnNextJavascriptStatement("Break on start");
v8::MaybeLocal<v8::Value> retval =
args[0].As<v8::Function>()->Call(env->context(), args[1],
call_args.size(), call_args.data());
args.GetReturnValue().Set(retval.ToLocalChecked());
}

But it apparently doesn't handle exceptions.

This code was introduced in 7954d2a (#12076). cc @eugeneo

@seishun seishun changed the title Requiring non-existent module while in debugger hard crashes Exception after "break on start" causes hard crash Jun 4, 2017
addaleax pushed a commit that referenced this issue Jun 10, 2017
Fixes: #13438
PR-URL: #13455
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
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 v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants