nodejs/node

Debug process didn't close after finish debugging

kiddkai opened this issue ยท 35 comments

In both io.js and node.js >= 0.12 have this issue.

OS:

osx & ubuntu 14

Reproduce steps:

  • Create a file:

a.js

console.log('debug');
  • run node debug a.js
  • press c to continue

Then the stdout should have:

> debug
> program terminated

But currently, it only have

> debug
  • When I try to press c to continue and make the process close, but it just stuck there waiting for v8 response.

It happen when I write my own debugger. It seems that the debug server should knows that the process is terminated, but it didn't.

cross-ref: nodejs/node-v0.x-archive#25358
i'll mark as confirmed-bug because the joyent folks seem to have also

Trying it on mac, latest atom, Node 0.12.4, and it doesn't seem to work. F5 just says "finish debugging :) "

Hey @pitosalas , it seems that your configuration is not correct. Which can not find the node.js binary? Is there any error popup shows up? Anyway, please move the node-debugger conversation to https://github.com/kiddkai/atom-node-debugger.

Here is the issues for io.js.

Hi, i don't know how...and why...but all shortcuts are disabled.
I don't see any "Enable" checkbox in settings page, what can you do to fix it ?

OS: Windows 7 64bit

Ty

#2778 got reverted in 9b02442 so this issue is still relevant.

This is frustrating me too. I end up restarting my terminal (iTerm2 on this machine) to get out and start again...

OS: OS X EI Capitian
my Node Path: "/Users/liuhongyu/.nvm/versions/node/v4.0.0/bin/node"
error: node executable could not be found

All shortcuts are disabled.I am using Windows 7 64 bit system.
Can someone help me out.

It's possible that this was fixed recently in v5 and master. Can anyone confirm?

Nope, still an issue unfortunately. /cc @thealphanerd

assigned to myself... will dig in next week

I can confirm that this bug is present in v4, v5, and v0.12. v0.10 appears to work as expected (assuming the exepcted behavior is that the debugger informs you of the program terminating

i have confirmed this problem from node 4.4.2 to 6.2.2.

I used "node debug a.js" to test debugger.

This works in old version.

This problem affect other product such as WebStorm.

If this is by design, then should let WebStorm fix it.

Any news about this? I'm still affected using Visual Studio Code and Node 6.5.0

I'm also still affected using Visual Studio Code 1.6.1 and Node 6.9.1.

I am having the same experience. Any ideas regarding this development? Node 7.1.0 and VSCode 1.7.1

For those on Linux (esp using VS code) who want a really hacky way to terminate the debugger on process exit, here you go...

process.on('exit', (code) => {
    // this force terminates the debugger by attaching to the debugger socket via it's FD and destroying it!
    try {
        new require('net').Socket({
            fd: parseInt(
                require('child_process').spawnSync('lsof', ['-np', process.pid], {encoding:'utf8'})
                    .stdout.match(/^.+?\sTCP\s+127.0.0.1:\d+->127.0.0.1:\d+\s+\(ESTABLISHED\)/m)[0].split(/\s+/)[3]
                , 10)
        }).destroy();
    } catch(e) {}
});

Closing this. If this is still an issue that needs to be fixed, we can reopen.

@jasnell, on what basis did you close this bug?

It seems to be a long-standing Node bug that keeps popping up (usually other front-end debugging tools are inappropriately blamed). Why can't it be acknowledged and then fixed?

The old debugger has been deprecated and removed as of 8.0.0. While this issue may be relevant still in older versions, and while I'd really like to see these older issues addressed, the likelihood that someone with enough domain expertise to resolve the issue is going to pick it issue up and fix it in 6.x or 4.x is fairly low, unfortunately. We can certainly reopen the issue but we would need someone to move it forward.

@jasnell, so this is fixed in the new debugger?

I am using Visual Studio Code. Do you have any pointers for using the new debugger with it?

Just install node 8.0?

I see no problem closing the issue.

Overall I am very happy with the debugging progress in Node. Using the --inspect flag and chrome devtools is an immense boost in productivity. Thanks @jasnell @bnoordhuis and all. โœจ๐Ÿ™โœจ

I'm still having this issue by using VS Code 1.13.1 / Node 8.1.1. If I run a gulp task, it won't get finished until I stop the debugger.

I confirm the same problem with code 1.13.1 and node v8.1.2

Still a problem in node v8.1.2. Please re-open. @jasnell

What is? Please be specific.

Actual behavior
debug session does not stop when node script has finished running

Expected behavior
when a node script has finished running, the debug session should end

Steps to reproduce

  1. Open an empty folder in VSCode
  2. Add a default launch debug configuration (Debug->Add Configurations...)
  3. Create a .js file with contents console.log('test');
  4. Launch the debugger
  5. Observe that the debug toolbar stays active and indicates that the script is executing after 'test' has been written to the console

OS: Ubuntu 17.10 & MacOS Sierra
Node: v8.1.2
Editor: Visual Studio Code 1.13.1

@bnoordhuis

@millermatt Thanks. Is there reason to assume it's a node.js issue? It sounds like a tooling issue in VS Code.

microsoft/vscode#5831 (comment)

The above issue in the VS Code repo led me to this node.js issue. I can't say for certain whether the problem is with VS Code or node.js. Based on the conversations in both issues it seems more likely that is a node.js problem.

@bnoordhuis

@millermatt Right, but that was with the old debugger, which has been removed. The inspector (the new debugger) is completely different so it's unlikely to be the same issue.

I'd take this up with the VS Code people first. If it does turn out to be a node.js issue, file a new issue and I'll take a look.

@bnoordhuis Good call - looks like they have a fix for the next release. microsoft/vscode-node-debug2#11

For anyone googling, couldn't make the process exit with process.exit() when debugger was attached, but process.kill(process.pid) worked

This still happens with node 8.7.0 under Webstorm debugging. Seems to be related to node rather than the IDE.

@georgeionita can you give detailed steps to reproduce?