Skip to content

debugger: fix stuck debugger when debuggee exits#6332

Closed
reshnm wants to merge 3 commits intonodejs:masterfrom
reshnm:fix_stuck_debugger
Closed

debugger: fix stuck debugger when debuggee exits#6332
reshnm wants to merge 3 commits intonodejs:masterfrom
reshnm:fix_stuck_debugger

Conversation

@reshnm
Copy link
Contributor

@reshnm reshnm commented Apr 21, 2016

Checklist
  • tests and code linting passes
  • a test and/or benchmark is included
  • the commit message follows commit guidelines
Affected core subsystem(s)

debugger

Description of change

Referencing PR #27778

The debuggee node process will never exit because the execution
is blocked inside node::debugger::Agent::Stop,
joining the agent thread.
The debug agent thread is blocked inside uv_run.

To fix this, the debug agent has to close all client connections
in _debug_agent.js (process._debugAPI.onclose).

Additionally all remaining opened handles have to be closed
before calling uv_loop_close.
Otherwise uv_loop_close will fail with UV_EBUSY.

Assume the following script (debug.js):

console.log('debug');

Calling node debug debug.js produces the following output:

< Debugger listening on port 5858
connecting to 127.0.0.1:5858 ... ok
break in debug.js:1
> 1 console.log('debug');
  2 
  3 });
debug> c
< debug
program terminated
debug> 

Both

node --debug -e 0

and

node --debug-brk -e 0

exit immediately.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

confirmed-bug Issues with confirmed bugs. stalled Issues and PRs that are stalled.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants