Debugging running node process

122 views
Skip to first unread message

Vivek Goel

unread,
Sep 18, 2013, 7:21:04 AM9/18/13
to nod...@googlegroups.com
Hi,
I have node daemon (gearman worker). Sometime I am facing the problem that the process don't respond to some particular requests (gearman jobs).

I am using following modules
  • gearman
  • mysql
  • redis
  • aws sdk
  • node-gcm
  • node-apn

I don't know in which module the program is hanging. Is it hanging in my code or some of third party code.

Is there a way to find out in which module it is hanged  (while process is in running state) ?


What are the methods used for debugging already running process in node ?




Andrey

unread,
Sep 18, 2013, 6:38:55 PM9/18/13
to nod...@googlegroups.com
You can enable debugger agent in your process by sending SIGUSR1 ( see http://nodejs.org/api/debugger.html#debugger_advanced_usage )

Vivek Goel

unread,
Sep 19, 2013, 1:11:00 AM9/19/13
to nod...@googlegroups.com

But that will not give stack trace of all current callbacks.
I need to attach a breakpoint and wait,  but problem is I don't know where  is it  waiting. So breakpoint will be blind guess.

--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/WvqEUTu5DcM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Andrey

unread,
Sep 19, 2013, 2:38:59 AM9/19/13
to nod...@googlegroups.com
From debugger you have an option to 1) break on next js statement 2) enable statistical profiler (and later analyse with v8.log tick processor what functions are repeatedly executed)

Alexey Petrushin

unread,
Sep 19, 2013, 7:06:18 AM9/19/13
to nod...@googlegroups.com
node.js is extremely hard to debug, one method I found is - binary search - cut app in half and see in which half the problem is - and continue cutting in half until you found the source :).

Alexey Petrushin

unread,
Sep 19, 2013, 7:07:28 AM9/19/13
to nod...@googlegroups.com
But such approach applicable only if you can reproduce the problem, it's not always possible though ...

Vivek Goel

unread,
Sep 19, 2013, 10:36:49 AM9/19/13
to nod...@googlegroups.com


On Thursday, September 19, 2013 12:08:59 PM UTC+5:30, Andrey wrote:
From debugger you have an option to 1) break on next js statement 2) enable statistical profiler (and later analyse with v8.log tick processor what functions are repeatedly executed)
Sorry , If I am getting any thing wrong here.
My problem is callback hanged (lost some where). No next function is getting executed for particular one request here.
I think then attaching breakpoint on next statement or enabling statistical profile will not help here.

Please correct me if I am wrong.

 

Jeremy Darling

unread,
Sep 19, 2013, 10:41:22 AM9/19/13
to nodejs

Has helped me debug callback soup more than once.  I use it frequently on my Lenovo IdeaPad u310 for debugging, but not for editing, so it doesn't require a ton of resources.  On my I7 desktop I use it for both editing and debugging.


You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages