How can I get a list of callbacks in the Node work queue? (or, Why won't Node exit?)
You can use process._getActiveHandles()
and process._getActiveRequests()
See this discussion in node.js mailing list.
update: there is a good package for this - https://github.com/mafintosh/why-is-node-running
There is a npm module wtfnode to show what keep the nodejs app running when you sends SIGINT (ctrl-c) to it.
It internal uses process._getActiveHandles()
as mentioned in @andrey-sidrov's answer. The benefit of using wtfnode
is that it provides easy-to-read output.