node aborts with --debug when it self-exits

Created on 6 Apr 2017  路  4Comments  路  Source: nodejs/node

  • Version: 7.x, 6.x, 4.x (there is no --debug in master)
  • Platform: Linux (at least)
  • Subsystem: debugger

node --debug test/fixtures/printA.js (node's test/fixtures), node --debug -p process.features, `node --debug -e "console.log('hi')", all abort on https://github.com/nodejs/node/blob/610ac7d8581012e627a4f4b67450b423ddbda415/src/debug-agent.cc#L147 with UV_EBUSY, because there is still work.

The check seems invalid to me, uv_run() runs with NOWAIT, so its not guaranteed to run til the loop is empty, just until there is nothing that would involve blocking, IIRC.

I tried adding setTimeout() and setImmediate() into printA.js, same thing. I think the debugger just doesn't expect to be used to debug a node process which is not long-lived.

core/node (v8.x *$% u=) % ./node --debug test/fixtures/printA.js
(node:27775) [DEP0062] DeprecationWarning: node --debug is deprecated. Please use node --inspect instead.
Debugger listening on 127.0.0.1:5858
A
err -16/home/sam/w/core/node/out/Release/node[27775]: ../src/debug-agent.cc:148:void node::debugger::Agent::Stop(): Assertion `(err) == (0)' failed.
 1: node::Abort() [./node]
 2: node::Assert(char const* const (*) [4]) [./node]
 3: 0x5645e6a64394 [./node]
 4: node::debugger::Agent::~Agent() [./node]
 5: node::Environment::~Environment() [./node]
 6: node::Start(uv_loop_s*, int, char const* const*, int, char const* const*) [./node]
 7: node::Start(int, char**) [./node]
 8: __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
 9: _start [./node]
zsh: abort (core dumped)  ./node --debug test/fixtures/printA.js
confirmed-bug debugger

All 4 comments

/to @indutny

Unable to reproduce this on v6.x on Linux:

$ node --debug -e "console.log('hi')"
Debugger listening on [::]:5858
hi
^C

$ node --debug -p process.features

Debugger listening on [::]:5858
{ debug: false,
  uv: true,
  ipv6: true,
  tls_npn: true,
  tls_alpn: true,
  tls_sni: true,
  tls_ocsp: true,
  tls: true }
^C

Does anyone know what fixed this? (Sam is on an year-long vacation)

basically uv_loop_close returned error when tearing down the Environment and then the agent was the issue, and that seem to work now.

The inspector has been significantly reworked, there's probably no single commit that's responsible. I'll go ahead and close this out since it's working now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benjamingr picture benjamingr  路  135Comments

substack picture substack  路  878Comments

nicolo-ribaudo picture nicolo-ribaudo  路  147Comments

mikeal picture mikeal  路  197Comments

jonathanong picture jonathanong  路  91Comments