Repository navigation
regression: UnhandledPromiseRejection is not fired until process is terminated #24209
Description
Activity
(+cc @apapirovski who seems to be working on a related stuff)
It was regressed by following PR: #18207
Any updates on this? This is really unfortunate since scripts just hang in inconsistent state without letting users know that something's wrong.
maybe cc @nodejs/promises-debugging
- addedpromisesIssues and PRs related to ECMAScript promises.Issues and PRs related to ECMAScript promises.
on Nov 11, 2018 /ping @apapirovski
re-pinging @nodejs/promises-debugging
Is this a known issue? Works-as-expected/not-a-bug? Confirmed bug? Something else?
AFAIK this is done to prevent the possibility of an infinite recursion inside of the unhandled rejection listener.Ideally it would trigger the warning as soon as possible (as in: after a single tick). To prevent the recursion from being possible, that's not an option though (it should actually be possible for the case that no such listener is attached, since then there is no possibility for the recursion in the first place but this would result in different timings with the listener attached and without). However, we are able to trigger the warning on setImmediate / right after the microtask queue is exhausted. It is already implemented to trigger on queue exhaustion and therefore I guess it's a bug in the implementation for cases like these.
I am trying to look further into it but I am not that familiar with the microtask code.The summary of this bug isn't quite correct.
unhandledRejectionwas always fired as expected with the right timing. The only thing that didn't happen was logging the warning in case there was no listener forunhandledRejection. Fix is in #24632 but IMO this is a pretty insignificant bug.Reacted by snek and Ruben BridgewaterReacted by Andrey LushnikovThe only thing that didn't happen was logging the warning in case there was no listener for unhandledRejection. Fix is in #24632 but IMO this is a pretty insignificant bug.
Oftentimes program transitions into inconsistent state after throwing an exception and hangs forever; you never know if it's just slow fetching resources from the Web or it has thrown an exception until you terminate it.
Thank you @apapirovski for handling this ❤️
- added a commit that references this issue
on Nov 28, 2018 Fixed in 3ce9305
- added a commit that references this issue
on Nov 28, 2018 - added a commit that references this issue
on Jan 14, 2019 - added a commit that references this issue
on Feb 12, 2019 - added a commit that references this issue
on Feb 28, 2019
Repro
script.js:node script.jsExpected: the
UnhandledPromiseRejectionis reported as soon as it happens; the node.js processexits after 2 seconds.
Actual: nothing happens for 2 seconds, then the node.js process exits and only then prints
UnhandledPromieRejection.This works as expected in v8.12.0