Skip to content

Do not unref debug handle to avoid debug process stuck#2778

Closed
viirya wants to merge 1 commit into
nodejs:masterfrom
viirya:no-unref-debug
Closed

Do not unref debug handle to avoid debug process stuck#2778
viirya wants to merge 1 commit into
nodejs:masterfrom
viirya:no-unref-debug

Conversation

@viirya

@viirya viirya commented Sep 9, 2015

Copy link
Copy Markdown
Contributor

For a simple javascript file:

 console.log('debug');

Run node debug a.js to launch debug process. Press first c and the program outputs > debug. After that, press c again the process just gets stuck and has no response so we have to kill it.

This is because debug handle has been unrefed. Once the program is finished, the event loop will be exited and the debug process will be stuck when debug sends commend again. We shouldn't unref the debug handle because even the script is finished, we can still send more debug command such as restart.

Fixes #1788.

@mscdex mscdex added c++ Issues and PRs that require attention from people who are familiar with C++. debugger labels Sep 9, 2015
@bnoordhuis

Copy link
Copy Markdown
Member

Before we go into details, have you checked that it passes make test?

@viirya

viirya commented Sep 10, 2015

Copy link
Copy Markdown
Contributor Author

Thanks. I've noticed this patch would cause some tests failed. I will try to fix that.

@Fishrock123 Fishrock123 mentioned this pull request Sep 13, 2015
7 tasks
@Fishrock123

Copy link
Copy Markdown
Contributor

@bnoordhuis

Copy link
Copy Markdown
Member

Change itself LGTM but the commit log needs to confirm to the guidelines from CONTRIBUTING.md.

The debug process running "node debug a.js" will be stuck when the
script ends. This is because the debug handler has been unrefed.
We shouldn't unref the debug handler to avoid this problem.
@viirya

viirya commented Oct 11, 2015

Copy link
Copy Markdown
Contributor Author

@bnoordhuis Thanks for reminding the commit log format.

@viirya

viirya commented Oct 13, 2015

Copy link
Copy Markdown
Contributor Author

ping @bnoordhuis I've updated the commit log. Any other comments?

bnoordhuis pushed a commit that referenced this pull request Oct 13, 2015
The debug process running "node debug a.js" will be stuck when the
script ends. This is because the debug handler has been unrefed.
We shouldn't unref the debug handler to avoid this problem.

PR-URL: #2778
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@bnoordhuis

Copy link
Copy Markdown
Member

Landed in ff877e9, thanks.

@bnoordhuis bnoordhuis closed this Oct 13, 2015
jasnell pushed a commit that referenced this pull request Oct 28, 2015
The debug process running "node debug a.js" will be stuck when the
script ends. This is because the debug handler has been unrefed.
We shouldn't unref the debug handler to avoid this problem.

PR-URL: #2778
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@jasnell

jasnell commented Oct 28, 2015

Copy link
Copy Markdown
Member

Landed in v4.x-staging in dee9c74

@bnoordhuis

Copy link
Copy Markdown
Member

Just a heads up but this PR introduced a regression and I'm moving to revert it, please see #3585.

@jasnell

jasnell commented Oct 29, 2015

Copy link
Copy Markdown
Member

@bnoordhuis ... ugh... ok

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

Labels

c++ Issues and PRs that require attention from people who are familiar with C++.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants