Commit 3dc56c0
committed
stream: do not error on Duplex.from early return
`0bf9e9f833` (#65963) introduced a regression. It destroys the duplex
when an async function body resolves without consuming its input, so
that `pipeline()` propagates destruction upstream. It destroys it
through `destroyer()`, which synthesizes an `AbortError` for any stream
that is not yet finished.
The original behavior, as of node 26.9.0:
```
node -v
v26.9.0
node -e "require('node:stream').Duplex.from(async () => {})"
// no output; this is expected
```
The bug, as of node 26.10.0:
```
node -v
v26.10.0
node -e "require('node:stream').Duplex.from(async () => {})"
node:events:505
throw er; // Unhandled 'error' event
^
AbortError: The operation was aborted
at destroyer (node:internal/streams/destroy:328:11)
at node:internal/streams/duplexify:120:13
Emitted 'error' event on Duplexify instance at:
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
code: 'ABORT_ERR'
}
Node.js v26.10.0
```
This PR fixes that issue and adds a new regression test.
Refs: #65963
Signed-off-by: Eric Newport <kethinov@gmail.com>1 parent 03fcd8b commit 3dc56c0
2 files changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
119 | 124 | | |
120 | | - | |
| 125 | + | |
121 | 126 | | |
122 | 127 | | |
123 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
0 commit comments