This is the combination of a little documented feature of V8 mixed with a non-documented feature of the node.js debugger client. Say you have an already running node process that you want to debug. The most common scenario is a process that’s running wild on one of your testing environments and you want to see what’s wrong with it. So a backtrace would be helpful. And full debugging even more. The following should help:


# start the remote debugger in the already running node process
kill -s USR1 pid
# attach to the debugger using the node.js client
node debug host:5858
# see where you are
debug> pause
debug> bt

From there you can poke around. You can also continue and pause again to see if you seem to consistently end up in the same code area. Or write a script that regularly connects, dumps the backtrace and disconnects.

Happy debugging.

About these ads