-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throw within queueMicrotask callbacks should not crash Node #38145
Comments
The exception is reported via the |
@devsnek ah that make sense. Out of line question: there isn't an equivalent API on the Web that can do what |
If you mean to monitor those uncaught exceptions, try |
@devsnek although it's spec-conformant in that sense. Why wouldn't |
I'm reopening because it seems worth fixing (if possible) in the REPL. |
This actually works in the REPL of Node 12 and 14.4 but stopped working in Node 14.5. I think that the issue is that errors thrown in queueMicroTask don't get captured by the domain, and don't reach the domain error handler (in the repl). The behaviour change was probably caused by this change #33859 |
@Linkgoron Does it still need fixing? |
@EladKeyshawn yes, it does. The question is how something like that might be solved. One way would be to use child processes to execute the code and to detect fatal exceptions leading to a new child process. However, that would only recover the REPL but all former input would be lost. Thus, we would have to print a clear warning about what happened. This is the best solution I can think of and it would also resolve multiple other reports. |
There's been no further discussion or activity on this in years. Is this still relevant? Still an issue? Is it something that just needs to be documented better? |
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
If I understood the spec correct:
It should behave similarly as Timer tasks.
What do you see instead?
Node crashed
Additional information
I did some preliminary triages that hopefully helps a bit:
task_queues.js
invokerunMicrotask
node_task_queue.cc
which invokes V8'sPerformCheckpoint
under the hood.PerformCheckpoint
invoked V8'sRunMicrotasks
to actually evaluate those JS callbacks.But since V8's
PerformCheckpoint
returnsvoid
. I'm not sure how can Node be aware of any exceptions threw during the evaluation of those JS callbacks. Chromium seems to handle this fine but I haven't got time looking at its source.The text was updated successfully, but these errors were encountered: