Node.js: inspect what's left in the event loop that's preventing the script from exiting naturally
You can call process._getActiveRequests()
to get a list of active I/O requests and process._getActiveHandles()
to get a list of open handles/file descriptors.
The wtfnode
package utilizes the tools mentioned by @mscdex but presents in a more developer-friendly way. I highly recommend this for tracking down these annoyances.
const wtf = require('wtfnode');
// ...
wtf.dump();
Node.js, starting from version 8, provides a handy module to retrieve this kind of information.
async_hooks: an API to register callbacks tracking the lifetime of asynchronous resources created inside a Node.js application.