How can I get a list of callbacks in the Node work queue? (or, Why won't Node exit?)

On the Node.js about page, it says:

Node exits the event loop when there are no more callbacks to perform.

So, you can write a Node.js program that executes top-down and exits.

However, if you've bound callbacks for events, the program doesn't end until you call process.exit() or send the process a signal that tells it to exit.

I am wondering: is there a way to find out what callbacks are keeping the event loop from exiting?

You can use process._getActiveHandles() and process._getActiveRequests()

See this discussion in node.js mailing list.