GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — stream: apply multiple stream/iter fixes by jasnell · Pull Request #65652 · nodejs/node

stream: apply multiple stream/iter fixes #65652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jasnell wants to merge 11 commits into nodejs:main from jasnell:jasnell/stream-iter-fixes

Uh oh!

There was an error while loading. Please reload this page.

Closed

stream: apply multiple stream/iter fixes #65652

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit Hold shift + click to select a range
f3198c8
stream: fixup cancelation handling in pull()
jasnell Aug 29, 2026
a6b3429
stream: ensure iterator cleanup on done, reject, etc
jasnell Aug 29, 2026
15768a0
stream: fixup writer to terminate on consumer return/throw
jasnell Aug 29, 2026
939c708
stream: ensure stability of stored metadata
jasnell Aug 30, 2026
fc18b83
stream: defend against re-entrancy in writev
jasnell Aug 30, 2026
1c7fc6d
stream: ensure full-close semantics when closed
jasnell Aug 30, 2026
46c3160
stream: fix merge settlement tagging and falsy error tracking
jasnell Aug 30, 2026
6dae2a1
stream: cancel active stream/iter pulls
jasnell Aug 30, 2026
15368e2
stream: ensure pipeToSync requires synchronous close
jasnell Aug 30, 2026
1db964b
stream: replace object sentinel with symbol
jasnell Aug 30, 2026
acf4fe4
stream: address stream/iter review feedback
jasnell Aug 30, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Next Next commit
stream: fixup cancelation handling in pull()
Signed-off-by: James M Snell <[email protected]>
Assisted-by: Opencode
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@jasnell
jasnell committed Aug 31, 2026
commit f3198c8591cfceb1bb980388e9b27789d9a37217

There are no files selected for viewing

34 changes: 31 additions & 3 deletions 34 lib/internal/streams/iter/pull.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ const {
isPromise,
isUint8Array,
} = require('internal/util/types');
const { AbortController } = require('internal/abort_controller');
const {
AbortController,
AbortSignal,
} = require('internal/abort_controller');

const {
arrayBufferViewToUint8Array,
Expand Down Expand Up @@ -862,8 +865,33 @@ function pull(source, ...args) {

return {
__proto__: null,
async *[SymbolAsyncIterator]() {
yield* createAsyncPipeline(from(source), transforms, signal);
[SymbolAsyncIterator]() {
const controller = new AbortController();
const iteratorSignal = signal === undefined ?
controller.signal : AbortSignal.any([signal, controller.signal]);

async function* pipeline() {
yield* createAsyncPipeline(from(source), transforms, iteratorSignal);
}
const iterator = pipeline();

return {
__proto__: null,
next(value) {
return iterator.next(value);
},
return(value) {
controller.abort(lazyDOMException('Aborted', 'AbortError'));
return iterator.return(value);
},
throw(error) {
controller.abort(error);
return iterator.throw(error);
},
[SymbolAsyncIterator]() {
return this;
},
};
},
};
}
Expand Down
30 changes: 30 additions & 0 deletions 30 test/parallel/test-stream-iter-pull-async.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,35 @@ async function testPullSignalAbortWhileSourceNextPending() {
await assert.rejects(next, { name: 'AbortError' });
}

async function testPullReturnWhileSourceNextPending() {
let startNext;
const nextStarted = new Promise((resolve) => { startNext = resolve; });
const source = {
[Symbol.asyncIterator]() {
return {
next() {
startNext();
return new Promise(() => {});
},
};
},
};

const iter = pull(source)[Symbol.asyncIterator]();
const next = assert.rejects(iter.next(), { name: 'AbortError' });
await nextStarted;

const timeout = {};
const result = await Promise.race([
iter.return(),
new Promise((resolve) => setImmediate(resolve, timeout)),
]);

assert.notStrictEqual(result, timeout);
assert.deepStrictEqual(result, { value: undefined, done: true });
await next;
}

async function testPullSignalAbortWithTransformWhileSourceNextPending() {
const source = {
[Symbol.asyncIterator]() {
Expand Down Expand Up @@ -417,6 +446,7 @@ async function testTransformOptionsNotShared() {
testTapCallbackError(),
testPullSignalAbortMidIteration(),
testPullSignalAbortWhileSourceNextPending(),
testPullReturnWhileSourceNextPending(),
testPullSignalAbortWithTransformWhileSourceNextPending(),
testPullConsumerBreakCleanup(),
testPullTransformReturnsPromise(),
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.