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?