stream: `pipeTo` with `preventCancel` can hit `ERR_INTERNAL_ASSERTION` if destination errors before deferred write
Đang mở
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 122k
- Fork
- 37.3k
- Merge trung bình
- 4 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 283
Mô tả
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.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Chạy bản tái hiện được cung cấp trên v24.16.0 và so sánh với v24.14.1. Kiểm tra node:internal/webstreams/writablestream tại dòng 982 và node:internal/webstreams/readablestream tại dòng 1677, sau đó xem xét PR #61800; công việc được coi là hoàn tất khi một regression test xác nhận rằng preventCancel bị từ chối với lỗi của đích thay vì ERR_INTERNAL_ASSERTION.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 52/100