Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Signals aren't received when debugging #3167
Comments
ggreer
commented
Apr 24, 2012
|
Same behavior on 0.7.9-pre. |
It's more subtle than that. There are a couple of bugs in V8's debug agent that stopped it from working correctly when signals are involved. I've fixed that in 4359e81, ebfb8a5 and 48cdbff and forwarded the patch upstream[1]. The other issue is that while the debugger REPL is active (i.e. the script being debugged is suspended), signals like SIGINT and SIGTERM are processed by Node, they're not forwarded to the script. I'm not sure if changing that is a good idea because then you wouldn't be able to ^C out of the debugger anymore. |
ggreer
commented
Apr 24, 2012
|
I agree with you. It doesn't make sense to forward some signals to the child. The debugger needs to handle them correctly though. Right now ctrl+c exits the debugger even if I'm in the REPL. Here's some code and the output I get when running it: https://gist.github.com/2476191 I get the same output using 0.6.15 on OS X and Ubuntu, so I don't think this is an OS-specific issue. Tomorrow I might try throwing some console.log()s in _debugger.js to see what the deal is. Or if I'm feeling particularly masochistic, run the debugger in a debugger. |
ggreer
commented
Apr 27, 2012
|
After messing around with this more, it looks like there's more than one issue. Right now if you run To make my terminology unambiguous:
74239 is the parent, 74241 is the child, and 74243 is the grandchild. If I hit ctrl+c in the repl, 74241 dies. Example in this gist: https://gist.github.com/2512948 I'm pretty sure this is because of line 1522 in _debugger.js. It doesn't seem to handle all SIGINTs sent to the process. That's probably desirable, but in this case it's not handling a signal that we want it to handle. Here's a gist of the behavior after I threw some console.log()s in node and changed the line in question to use process.once: https://gist.github.com/2512032. The diff in that gist is against master. It looks like the SIGINT somehow makes it to the grandchild (74243 in this case). If the grandchild is halted at a breakpoint or it doesn't have a SIGINT handler, it dies. |
|
/cc @indutny |
ghost
assigned
indutny
May 5, 2012
|
@indutny ... do you happen to recall the status of this one? |
|
Sorry, but not really. Guess we worked it out. |
|
@ggreer closing. If this continues to be an issue, we can reopen and revisit. |
ggreer commentedApr 23, 2012
When using child_process.spawn() to run node in debug mode, signals sent to the child aren't received. You can see an example in this gist: https://gist.github.com/2474314/
If you remove the debug argument on line 14 of signals.js, the SIGINT handler in example.js fires. I'm pretty sure the issue is that
node debugspawns a child process that runs example.js, but it doesn't forward signals along to the child.I'm using node 0.6.15 on OS X 10.7.3.
If you're curious, the reason I'm doing this craziness is because I'm trying to fix the debugger in whiskey.