Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

stream: `pipeTo` with `preventCancel` can hit `ERR_INTERNAL_ASSERTION` if destination errors before deferred write

未關閉
#63,732 2 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

nodejs/node 的其他 Issue

查看 nodejs/node 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。