user2503048
user2503048

Reputation: 1041

How to know what blocks NodeJS from closing

I have code that runs on NodeJS which involves intervals, sockets, and other async things.

Sometimes when it should close, it hangs forever, presumably since somewhere under some circumstances, I forget to clear an interval, close a socket, or something else.

Is there a way to get the currently active timers, and other such runtime information? Or inspect in any kind of way what blocks the exit?

Upvotes: 0

Views: 246

Answers (1)

user2503048
user2503048

Reputation: 1041

Found this package https://www.npmjs.com/package/wtfnode from a related question to this one (https://stackoverflow.com/a/38471228/2503048). Oddly enough I couldn't find this information when googling. It should probably answer my question. Mostly the part about process._getActiveHandles().

Upvotes: 1

Related Questions