Repository navigation
Assertion failure when calling process.exit() from a Worker that has TLA #43182
Description
Activity
/cc @nodejs/workers
- addedconfirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.workerIssues and PRs related to the worker_threads module and Worker API.Issues and PRs related to the worker_threads module and Worker API.
on May 22, 2022 V8 asserts the evaluation of the module's async function to succeed without exception. However, the problem is that TerminateExecution initiated by
process.exitis breaking that assumption. I'll work on this and submit a fix to v8.Reacted by Antoine du Hamel@legendecas, are you working on this?
@sajal50 yeah, it is still under review at https://chromium-review.googlesource.com/c/v8/v8/+/3696493.
https://chromium-review.googlesource.com/c/v8/v8/+/3696493 has landed. I'll continue to investigate if node handles these termination exceptions properly.
Reacted by Antoine du Hamel and Benjamin Gruenbaum@legendecas I've tried to cherry-pick your commit in node repo, but it looks like it relies on V8 APIs that are not available in the version of V8 we are using. Do you know if it's worth a backport or if we'd be better off waiting for V8 10.5 to stabilize?
- added 2 commits that reference this issue
on Jul 12, 2022 - added a commit that references this issue
on Jul 26, 2022 - added a commit that references this issue
on Aug 2, 2022 Another reproduction case (it's weird, remove
joinand it works?):import { join } from 'node:path'; import { isMainThread, Worker } from 'node:worker_threads'; if (isMainThread) { new Worker(new URL(import.meta.url)); await 0; } else { process.exit(); join(); }
Is there a chance for this to be backported into Node.js 14?
- added a commit that references this issue
on Oct 10, 2022 @szmarczak I tried a backport but V8 has changed a lot since v14. It might need a totally new patch for the issue on v14 (and a refresh review on the patch too).
No problem. Thanks for trying ❤️
- added a commit that references this issue
on May 5, 2024
Version
masterPlatform
macOS
Subsystem
worker_threads
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
No crash
What do you see instead?
Additional information
The bug is reproducable on v14.x, v16.x, and v18.x lines.