Skip to content

stream/iter: Writer.end() ignores AbortSignal #64726

Description

@trivikr

Version

main

Platform

macOS 26.5.2

Subsystem

stream

What steps will reproduce the bug?

import{push}from'node:stream/iter';asyncfunctionrepro(label,abortBeforeEnd){const{ writer, readable }=push();awaitwriter.write('x');constcontroller=newAbortController();if(abortBeforeEnd)controller.abort(newError('stop'));constending=writer.end({signal: controller.signal}).then((bytes)=>`resolved: ${bytes}`,(error)=>`rejected: ${error.message}`,);if(!abortBeforeEnd)controller.abort(newError('stop'));constdraining=(async()=>{forawait(constchunkofreadable){voidchunk;}})();console.log(`${label}: ${awaitending}`);awaitdraining;}awaitrepro('pre-aborted',true);awaitrepro('aborted while draining',false);

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

it should reject with the signal’s abort reason in both cases.

What do you see instead?

pre-aborted: resolved: 1aborted while draining: resolved: 1

end() resolves successfully whether the signal is already aborted or becomes aborted while the buffered data is draining.

Additional information

No response

Metadata

Metadata

Assignees

Labels

streamIssues and PRs related to the stream subsystem.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions