Skip to content

stream: reject iter consumers on abort#64066

Open
trivikr wants to merge 2 commits into
nodejs:mainfrom
trivikr:stream-iter-consumers-abort-signal
Open

stream: reject iter consumers on abort#64066
trivikr wants to merge 2 commits into
nodejs:mainfrom
trivikr:stream-iter-consumers-abort-signal

Conversation

@trivikr

@trivikr trivikr commented Jun 22, 2026

Copy link
Copy Markdown
Member

Fixes: #64065

This updates node:stream/iter async consumers to reject promptly when
their abort signal fires while an async iterator read is pending.

Previously, bytes(), text(), arrayBuffer(), and array() only checked
the signal before and after receiving a batch. If the source was stuck in a
pending next(), aborting the signal did not settle the consumer promise.

The change reuses the abort-aware iterator wrapper from the pull pipeline by
moving it into shared stream/iter utils, then applies it in consumers before
normalization and while consuming the normalized source.


Assisted-by: openai:gpt-5.5

Make stream/iter async consumers observe abort signals while waiting
for a pending async iterator read. This lets bytes(), text(),
arrayBuffer(), and array() reject promptly with the abort reason
instead of waiting for another batch.

Move the shared abort-aware iterator wrapper to stream/iter utils so
pull and consumers use the same helper.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem. labels Jun 22, 2026
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stream/iter consumers do not reject on abort while async iterator is pending

2 participants