Version
main
Platform
Subsystem
stream
What steps will reproduce the bug?
import { merge } from 'node:stream/iter';
import { setTimeout } from 'node:timers/promises';
const source = {
[Symbol.asyncIterator]() { return this; },
next() { return new Promise(() => {}); },
return() {
console.log('source closed');
return { done: true };
},
};
const iterator = merge(source, {
signal: AbortSignal.timeout(10),
})[Symbol.asyncIterator]();
console.log(await Promise.race([
iterator.next().then(null, (error) => error.name),
setTimeout(100, 'still pending'),
]));
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
source closed
TimeoutError
As per §12.2 Stream.merge()
On cancellation (via signal or consumer break), call .return() on all active iterators and discard ready.
What do you see instead?
The pending merged read remains unsettled and source closed is never printed
Additional information
No response
Version
main
Platform
Subsystem
stream
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
As per §12.2
Stream.merge()What do you see instead?
still pendingThe pending merged read remains unsettled and
source closedis never printedAdditional information
No response