Skip to content

stream/iter: pull() with AbortSignal hangs while awaiting source next() #63497

@trivikr

Description

@trivikr

Version

26.2.0

Platform

macOS 26.5.0

Subsystem

stream

What steps will reproduce the bug?

import { pull } from 'node:stream/iter';

const source = {
  async *[Symbol.asyncIterator]() {
    await new Promise(() => {});
  },
};

const ac = new AbortController();
const iterator = pull(source, { signal: ac.signal })[Symbol.asyncIterator]();

const next = iterator.next().then(
  () => 'settled: fulfilled',
  (err) => `settled: rejected with ${err.name}: ${err.message}`,
);

ac.abort();

console.log(await Promise.race([
  next,
  new Promise((resolve) => setTimeout(resolve, 100, 'still pending after abort')),
]));

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

Always

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

settled: rejected with AbortError: This operation was aborted

Passing { signal } to pull() should let them stop the pipeline even when the source is idle or waiting for more data.

What do you see instead?

still pending after abort

The no-transform path remains stuck until the source eventually yields, so aborting does not actually abort the pending read.

Additional information

No response

Metadata

Metadata

Assignees

Labels

streamIssues and PRs related to the stream subsystem.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions