nodejs / nodejs/node

Debugger crashes with assertion failure while using Chrome DevTools and remote debug

Open
#17,259 21 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

async_hooks inspector
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

  • Version:
    8.9.1 LTS
  • Platform:
    macOS 10.13.1 (17B48) (Darwin Kernel Version 17.2.0)

Webstorm 2017.2.5
Chrome: 62.0.3202.94

No crash using Webstorm 2017.1.4

While using the Chrome DevTools and node --inspect, the node process crashes right after Chrome auto-detected the debug session as a network target.

/usr/local/bin/node[28426]: ../src/node.cc:1449:void node::InternalCallbackScope::Close(): Assertion `(env_->trigger_async_id()) == (0)' failed.
 1: node::Abort() [/usr/local/bin/node]
 2: node::(anonymous namespace)::DomainEnter(node::Environment*, v8::Local<v8::Object>) [/usr/local/bin/node]
 3: node::InternalCallbackScope::Close() [/usr/local/bin/node]
 4: node::InternalCallbackScope::~InternalCallbackScope() [/usr/local/bin/node]
 5: node::RunForegroundTask(v8::Task*) [/usr/local/bin/node]
 6: node::NodePlatform::FlushForegroundTasksInternal() [/usr/local/bin/node]
 7: node::inspector::NodeInspectorClient::runMessageLoopOnPause(int) [/usr/local/bin/node]
 8: v8_inspector::V8Debugger::handleProgramBreak(v8::Local<v8::Context>, v8::Local<v8::Value>, std::__1::vector<int, std::__1::allocator<int> > const&, bool, bool) [/usr/local/bin/node]
 9: v8::internal::Debug::OnDebugBreak(v8::internal::Handle<v8::internal::FixedArray>) [/usr/local/bin/node]
10: v8::internal::Debug::Break(v8::internal::JavaScriptFrame*) [/usr/local/bin/node]
11: v8::internal::Runtime_DebugBreakOnBytecode(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
12: 0x2fb5b0f842fd
13: 0x2fb5b108876c
14: 0x2fb5b103d1e0
nodejscrash

Reproduce:

  • Clone Demo Project: https://github.com/Microsoft/TypeScript-Node-Starter/
  • Install mongodb via homebrew
  • Start mongodb via mongod --config /usr/local/etc/mongod.conf
  • Open demo project in Webstorm, npm run build and configure a run configuration by adding Node.js Run Configuration and change JavaScript file to dist/server.js
  • Set breakpoint in src/controllers/user.ts Line 30
  • Start debugger with the Bug icon, right next to the run icon in Webstorm
  • Open client site in Chrome http://localhost:3000
  • Use the client site to trigger breakpoint (logged in as user)
  • Resume by clicking Step Out
  • Use the client site to trigger breakpoint again (logged in as user)
  • Chrome: Right-click, Inspect
  • Debugger crashes as shown

For me, this crash is only reproducible on one of three Mac systems with identical software versions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the crash with Node 8.9.1, WebStorm, Chrome DevTools, and the TypeScript-Node-Starter steps in the issue. Read the assertion in src/node.cc at InternalCallbackScope::Close and follow the NodeInspectorClient::runMessageLoopOnPause stack path. Done means remote debugging and Chrome DevTools no longer crash the Node process.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.