-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve debugger for multi-threaded applications #180
Comments
As asked on UserVoice, here's the info I have on the topic. I want to debug a node application that uses multiple processes (through cluster). Trying this in Nodeclipse failed however. First thing that failed was that the node app wouldn't launch properly at all when using the debug-brk options. Once that was disabled (by checking the option "run Node debug without -brk), the app can be started in debug mode, but breakpoints are never hit in the code that runs in a non-master process. I googled and found this: https://youtrack.jetbrains.com/issue/WEB-1919. This link basically describes that in Node 0.11.x support was added to connect a debugger to forked processes, by automagically assign an incremental debug port to every forked process, while writing the debug port number out to STDERR of the master process, like "Debugger listening on port 58xx". I see those messages showing up in the console in Nodeclipse as well. However, Nodeclipse only launches one debug process, by default on port 5858, so it is quite logical that breakpoints aren't hit when the code is executed in another process that uses another debug port. So, what I think needs to happen is that Nodeclipse monitors the STDERR for the messages "Debugger listening on port 58xx" and then automatically launches debug processes for these ports. I tried to manually add and launch STANDALONE_V8 debug processes with the portnumbers that node assigns to the child processes and then breakpoints get hit. So AFAICS it is a matter of listening to the STDERR for the port number messages, automatically launching a STANDALONE_V8 debugger on that port and making sure that these get killed/cleaned up propertly when terminating the main debug process or when one of the forked processes dies. |
Hi Paul. That is great research already. Logically, every process (of event looper) should have own port. https://youtrack.jetbrains.com/issue/WEB-1919 says, that since Node 0.11.5 every fork would get own port incrementally from base specified as
nodejs/node-v0.x-archive@43ec1b1 tagged as v0.11.14, Fixes nodejs/node-v0.x-archive#5318
For Node users before 0.11.5 ever forked process should get debug port manually I guess, using
@p-bakker Is that right? Now, back to Nodeclipse, I would try to first launch Debug session for master with Nodeclipse, I expect it should work for several debug session at the same time, though I never tried. Currently this is not on my list to go far with this, |
@p-bakker Please keep this thread updated |
Still looking into this one, unfortunately wasn't able to spend much time on it. I'll report back later this week |
Started as http://nodeclipse.uservoice.com/forums/216804-general/suggestions/4306388-improve-debugger-for-multi-threaded-applications by Andrew and P.
nodejs/node-v0.x-archive#5318 is labeled for Node 0.12 Milestone
The text was updated successfully, but these errors were encountered: