Version
26.2.0
Platform
Subsystem
stream
What steps will reproduce the bug?
import { push } from 'node:stream/iter';
import { setTimeout } from 'node:timers/promises';
const { writer, readable } = push();
const reader = readable[Symbol.asyncIterator]();
writer.fail(0);
const result = await Promise.race([
reader.next().then(
(value) => ({ type: 'settled', value }),
(reason) => ({ type: 'rejected', reason }),
),
setTimeout(100, { type: 'timeout' }),
]);
console.log(result);
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
{ type: 'rejected', reason: 0 }
next() should reject with the stored failure reason, including falsy values such as 0 or false, because fail(reason) accepts any value.
What do you see instead?
After calling writer.fail(0), a subsequent readable[Symbol.asyncIterator]().next() does not settle and the repro times out.
Additional information
No response
Version
26.2.0
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?
{ type: 'rejected', reason: 0 }next()should reject with the stored failure reason, including falsy values such as0orfalse, becausefail(reason)accepts any value.What do you see instead?
{ type: 'timeout' }After calling
writer.fail(0), a subsequentreadable[Symbol.asyncIterator]().next()does not settle and the repro times out.Additional information
No response