why-is-node-running is a diagnostic tool for Node.js developers that helps answer the question: “why is my Node.js process still alive?” In complex asynchronous code — with timers, open handles, network sockets, file watchers, or unfulfilled promises — it can be tricky to figure out what is preventing the event loop from exiting. This utility inspects the active handles and resources in the runtime, prints a breakdown of open callbacks, sockets, timers, and other tasks, and explains what’s keeping Node running, helping you track down leaks or unintended resource retention. It’s particularly useful during testing, when you expect Node to exit after tests finish, or in long-running servers when you're debugging resource leaks or shutdown logic. By providing clear human-readable output that lists current handles and their origins, the tool dramatically reduces the time you would otherwise spend manually instrumenting your code.
Features
- Inspects active handles, callbacks, timers, sockets and other asynchronous resources in Node.js
- Outputs a human-readable breakdown of what prevents Node from exiting
- Helps detect resource leaks, unclosed timers/sockets or stuck promises during testing or shutdown
- Usable as a standalone CLI or as a module inside code
- Compatible with many Node.js versions without requiring code changes
- Minimal overhead — can be added temporarily during debugging without heavy setup