0

In Java, if a process does not die when I expect, I usually take a thread dump and see what the threads are doing. There will usually be a non-daemon thread that is waiting for something, and I forgot to call a thread pool shutdown method, for instance.

In Node I'm not sure what is responsible for keeping the process alive. It's of course its thread, but I don't know how it decides when to kill its thread. Usually it's a database connection I forgot to close, but at present I have a process that is hanging even after closing the database connection pool, and I'm not sure what could be keeping it alive or how to inspect it.

How to troubleshoot this?

djechlin
  • 59,258
  • 35
  • 162
  • 290
  • are you using process.waitFor(); in your code? – Abhishek Aug 16 '13 at 08:27
  • @Abhishek my top-level module is maybe 10 lines long, that won't help. And I don't know what code to post of my thousands of lines of library code, that's precisely the problem. I have no idea if any of the dozen or so libraries I'm using use process.waitFor(). I could of course grep through them and find out, but only sort of, as this is Javascript - `process['waitFor']` also works, for instance, but even then that wouldn't tell me if these calls ever complete. – djechlin Aug 16 '13 at 12:02
  • try to put process[waitFor] within comments..and try executing the code..if node dies..then you will know the answer..else we l find another way out,, – Abhishek Aug 16 '13 at 12:15

0 Answers0