-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Open
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.processIssues and PRs related to the process subsystem.Issues and PRs related to the process subsystem.replIssues and PRs related to the REPL subsystem.Issues and PRs related to the REPL subsystem.
Description
- Version:v15.9.0
- Platform: macOS x86
- Subsystem: task_queues
What steps will reproduce the bug?
λ node --trace-uncaught
Welcome to Node.js v15.9.0.
Type ".help" for more information.
> queueMicrotask(_ => { throw 1 });
undefined
>
node:internal/process/task_queues:94
runMicrotasks();
^
1
Thrown at:
at processTicksAndRejections (node:internal/process/task_queues:94:5)
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
If I understood the spec correct:
The queueMicrotask(callback) method must queue a microtask to invoke callback, and if callback throws an exception, report the exception.
It should behave similarly as Timer tasks.
> setTimeout(_ => {throw 1});
Timeout {
...
}
> Uncaught 1
What do you see instead?
Node crashed
Additional information
I did some preliminary triages that hopefully helps a bit:
task_queues.js
invokerunMicrotask
- which is a JS binding from
node_task_queue.cc
which invokes V8'sPerformCheckpoint
under the hood. - V8's
PerformCheckpoint
invoked V8'sRunMicrotasks
to actually evaluate those JS callbacks.
But since V8's PerformCheckpoint
returns void
. 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.
aryehischechter
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.processIssues and PRs related to the process subsystem.Issues and PRs related to the process subsystem.replIssues and PRs related to the REPL subsystem.Issues and PRs related to the REPL subsystem.