You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I just debugged this really confusing issue with an unexpected exit in Archiver.js: archiverjs/node-archiver#457
The whole time I was thinking, I really wish Node could help me understand why the process is exiting when there are no unhandled rejections and no uncaught errors.
In my app code I was awaiting a promise that was ultimately waiting for the Archiver.js stream to emit an end or error event. But because I forgot to call .finalize() on the archive, it reached a point where it didn't put any new events onto the queue and Node exited with code 0. Which I'm calling a bug with Archiver.js, but the difficulty of debugging bugs like this is a problem. (Just imagine how confused a novice would be about this, when they don't even know about the event loop.)
Describe the solution you'd like
I'm not sure if it's possible, and not sure if there would be unintended consequences to this, but I'm wondering if there's any way for Node to keep track of when a promise is being awaited and warn if it exits due to empty event loop in that case. Or at least a flag to debug unexpected exits in this way?
Describe alternatives you've considered
I was eventually able to figure this issue out by profiling it and realizing I forgot to call .finalize(), but that was after an hour of being utterly confused. If I had been able to run with a switch that would have made it print a warning like process exited because event loop became empty, even though there are unresolved promises, I might have realized sooner what was going on.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I just debugged this really confusing issue with an unexpected exit in Archiver.js: archiverjs/node-archiver#457
The whole time I was thinking, I really wish Node could help me understand why the process is exiting when there are no unhandled rejections and no uncaught errors.
In my app code I was awaiting a promise that was ultimately waiting for the Archiver.js stream to emit an
end
orerror
event. But because I forgot to call.finalize()
on the archive, it reached a point where it didn't put any new events onto the queue and Node exited with code 0. Which I'm calling a bug with Archiver.js, but the difficulty of debugging bugs like this is a problem. (Just imagine how confused a novice would be about this, when they don't even know about the event loop.)Describe the solution you'd like
I'm not sure if it's possible, and not sure if there would be unintended consequences to this, but I'm wondering if there's any way for Node to keep track of when a promise is being awaited and warn if it exits due to empty event loop in that case. Or at least a flag to debug unexpected exits in this way?
Describe alternatives you've considered
I was eventually able to figure this issue out by profiling it and realizing I forgot to call
.finalize()
, but that was after an hour of being utterly confused. If I had been able to run with a switch that would have made it print a warning likeprocess exited because event loop became empty, even though there are unresolved promises
, I might have realized sooner what was going on.The text was updated successfully, but these errors were encountered: