stream: `pipeTo` with `preventCancel` can hit `ERR_INTERNAL_ASSERTION` if destination errors before deferred write
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Führe die bereitgestellte Reproduktion auf v24.16.0 aus und vergleiche sie mit v24.14.1. Untersuche node:internal/webstreams/writablestream in Zeile 982 und node:internal/webstreams/readablestream in Zeile 1677 und prüfe anschließend PR #61800; abgeschlossen ist die Aufgabe, wenn ein Regressionstest bestätigt, dass preventCancel mit dem Zielfehler abgewiesen wird statt mit ERR_INTERNAL_ASSERTION.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, node.js
- Bereich
- backend
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 52/100