Terminating a worker while it evaluates the parent of a top-level-await module aborts the process
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 52/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, node.js
- 领域
- backend
调研方向
Start by reading the V8 change linked in the issue, be84cdeee94e, and inspect the Node.js V8 dependency updates for the affected v22.x, v24.x, and v26.x branches. Reproduce with the three module files from the report and verify the worker terminates without a process crash; the issue says the fix needs a cherry-pick.
由索引模型根据 Issue 内容生成。
描述
Version
v26.13.0, v24.15.0, v22.22.3
Platform
Darwin 25.6.0 arm64
Subsystem
esm, worker_threads
What steps will reproduce the bug?
tla.mjs:
await 0
parent.mjs:
import { parentPort } from 'node:worker_threads'
import './tla.mjs'
parentPort.postMessage('running')
const end = Date.now() + 5000
while (Date.now() < end);
main.mjs:
import { Worker } from 'node:worker_threads'
import { once } from 'node:events'
const worker = new Worker(new URL('./parent.mjs', import.meta.url))
await once(worker, 'message')
await worker.terminate()
console.log('terminated without crashing')
node main.mjs
How often does it reproduce? Is there a required condition?
Every time. parent.mjs has no top-level await, but it imports a module that does. So V8 runs parent.mjs's body from AsyncModuleExecutionFulfilled after tla.mjs settles, and the worker is terminated while that body is running. If you remove the await from tla.mjs, the worker terminates cleanly.
What is the expected behavior? Why is that the expected behavior?
worker.terminate() stops the worker, and main.mjs prints terminated without crashing.
What do you see instead?
#
# Fatal error in , line 0
# Check failed: !is_null().
#
----- Native stack trace -----
1: node::NodePlatform::GetStackTracePrinter()::$_0::__invoke()
2: V8_Fatal(char const*, ...)
3: v8::internal::SourceTextModule::ExecuteAsyncModule(v8::internal::Isolate*, v8::internal::DirectHandle<v8::internal::SourceTextModule>) (.cold.1)
4: v8::internal::SourceTextModule::AsyncModuleExecutionFulfilled(v8::internal::Isolate*, v8::internal::Handle<v8::internal::SourceTextModule>)
5: v8::internal::Builtin_CallAsyncModuleFulfilled(int, unsigned long*, v8::internal::Isolate*)
6: Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit
7: Builtins_PromiseFulfillReactionJob
8: Builtins_RunMicrotasks
...
24: node::worker::Worker::Run()
The process exits with code 133. On v22 and v24 the message is Check failed: (location_) != nullptr.
Additional information
ExecuteModule fails with the termination exception and leaves exception empty. AsyncModuleExecutionFulfilled then calls exception.ToHandleChecked() on it. V8 fixed this in https://github.com/v8/v8/commit/be84cdeee94e ("[d8] Handle termination exception in async modules"), which returns early when execution is terminating, and main has it through the V8 update. v22.x, v24.x and v26.x don't have it, so it needs a cherry-pick.
Probably the same crash as #53238 and #62114, both closed without a repro.
- 主要语言
- JavaScript
- 星标
- 124k
- 派生
- 38k
- 平均合并
- 4 天 2 小时
- 30 天内合并 PR
- 266
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nodejs/node 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 69/100
维护者通常 1 天内回复
-
fs: document readStream.start and readStream.end可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭doc
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
doc: document the Buffer.prototype.*Slice() methods可能已有人在做 @AyushCipher 今天认领。 未关闭doc
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
`styleText` fast path bypasses `options` and `options.validateStream` validation可能已有人在做 @GBra-4-669 于 8 天前认领。 未关闭util
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
riscv64
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
相似的 Issue
-
bug triage needed
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
resource-submission validation-passed
难度 1/5 1 小时以内 新手友好度 82/100
hesreallyhim/awesome-claude-code#3773 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 73/100
tabatkins/railroad-diagrams#129 ·
-
web: api() turns a null or object-valued error body into a TypeError or "[object Object]" and loses the status可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复