stream: `pipeTo` with `preventCancel` can hit `ERR_INTERNAL_ASSERTION` if destination errors before deferred write
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 52/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- javascript, node.js
- 領域
- backend
研究方向
在 v24.16.0 上執行提供的重現,並與 v24.14.1 比較。檢查第 982 行的 node:internal/webstreams/writablestream 和第 1677 行的 node:internal/webstreams/readablestream,然後檢視 PR #61800;當回歸測試確認 preventCancel 因目的地錯誤而被拒絕,而不是因 ERR_INTERNAL_ASSERTION 被拒絕時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Version
v24.16.0
Platform
Linux n37-114-192 5.15.120.bsk.3-amd64 #5.15.120.bsk.3 SMP Debian 5.15.120.bsk.3 Fri Dec 8 12:41:09 UTC x86_64 GNU/Linux
Subsystem
stream
What steps will reproduce the bug?
const { ReadableStream, WritableStream } = require("node:stream/web");
let sourceController;
let destController;
const source = new ReadableStream({
start(controller) {
sourceController = controller;
},
});
const dest = new WritableStream({
start(controller) {
destController = controller;
},
write() {},
});
source.pipeTo(dest, { preventCancel: true }).catch((err) => {
console.log("pipeTo rejected:", err.name, err.message);
});
setImmediate(() => {
destController.error(new Error("destination errored"));
sourceController.enqueue("chunk");
});
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
pipeTo() should reject with the destination error, like v24.14.1 does:
pipeTo rejected: Error destination errored
What do you see instead?
node:internal/assert:11
throw new ERR_INTERNAL_ASSERTION(message);
^
Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
at assert (node:internal/assert:11:11)
at writableStreamDefaultWriterWrite (node:internal/webstreams/writablestream:982:3)
at node:internal/webstreams/readablestream:1677:33
at process.processTicksAndRejections (node:internal/process/task_queues:104:5) {
code: 'ERR_INTERNAL_ASSERTION'
}
Node.js v24.16.0
Additional information
The error starts to occur in v24.15.0. This lines up strongly with https://github.com/nodejs/node/pull/61800.
- 主要語言
- JavaScript
- 星號
- 122k
- 分支
- 37.4k
- 平均合併
- 4 天 2 小時
- 30 天內合併 PR
- 277
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
nodejs/node 的其他 Issue
-
doc
難度 2/5 1-3 小時 新手友好度 65/100
-
build
難度 1/5 1 小時以內 新手友好度 88/100
-
難度 2/5 1-3 小時 新手友好度 84/100
-
難度 1/5 1 小時以內 新手友好度 90/100
-
feature request
難度 2/5 1-3 小時 新手友好度 68/100
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 65/100
antfu-collective/icones#398 ·
-
ECmail.com 未關閉
難度 1/5 1 小時以內 新手友好度 90/100
wesbos/burner-email-providers#554 ·
-
難度 2/5 1-3 小時 新手友好度 65/100
radiantearth/stac-browser#1023 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 2/5 1-3 小時 新手友好度 75/100
components-web-app/docs#92 ·