Skip to content

stream: destroy source when map iterator closes early - #64264

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
Y1D7NG:fix-stream-find-some-every-destroy
Sep 7, 2026
Merged

stream: destroy source when map iterator closes early#64264
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
Y1D7NG:fix-stream-find-some-every-destroy

Conversation

@Y1D7NG

@Y1D7NG Y1D7NG commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Fixes: #64261

When some(), every(), or find() returns early, the underlying map() iterator closes but the source stream is never destroyed, leaving it open and preventing cleanup. The fix calls destroyImpl.destroyer(stream, null) in the map() iterator cleanup path so the source stream is destroyed when the iterator closes early.

@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 Node.js streams. labels Jul 2, 2026
@Y1D7NG

Y1D7NG commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@jasnell Could you please help review this? Thanks!

@trivikr
trivikr requested a review from jasnell July 9, 2026 05:53
Comment thread lib/internal/streams/operators.js
@ronag ronag added the semver-major PRs that contain breaking changes and should be released in the next major version. label Jul 9, 2026

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jul 13, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jul 13, 2026
@nodejs-github-bot

This comment was marked as outdated.

@trivikr trivikr added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. author ready PRs with CI started, the required approvals, and no outstanding review comments. labels Aug 22, 2026
@github-actions github-actions Bot added request-ci-failed Starting CI with the request-ci label failed and requires manual intervention. and removed request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Aug 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor
Failed to start CI
- Validating Jenkins credentials
✔  Jenkins credentials valid
- Querying data for job/node-test-pull-request/74793/
SyntaxError: Unexpected token '<', ..."    
  https://github.com/nodejs/node/actions/runs/32604643614

@trivikr trivikr removed the request-ci-failed Starting CI with the request-ci label failed and requires manual intervention. label Aug 23, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@trivikr

trivikr commented Aug 26, 2026

Copy link
Copy Markdown
Member

@Y1D7NG Can you please rebase?

The CI has been failing because of flaky tests which might have been marked/fixed in recent commits.

@Y1D7NG
Y1D7NG force-pushed the fix-stream-find-some-every-destroy branch from 963b76e to 457b5cb Compare September 6, 2026 15:46
Fixes: nodejs#64261
Signed-off-by: y1d7ng <y1d7ng@yeah.net>
@Y1D7NG
Y1D7NG force-pushed the fix-stream-find-some-every-destroy branch from 457b5cb to a28f607 Compare September 6, 2026 16:12
@Y1D7NG

Y1D7NG commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

@Y1D7NG Can you please rebase?

The CI has been failing because of flaky tests which might have been marked/fixed in recent commits.

@trivikr done, thanks for reminder

@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 6, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 6, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.20%. Comparing base (7991140) to head (a28f607).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64264      +/-   ##
==========================================
+ Coverage   90.19%   90.20%   +0.01%     
==========================================
  Files         771      771              
  Lines      264622   264621       -1     
  Branches    50223    50224       +1     
==========================================
+ Hits       238663   238710      +47     
+ Misses      16965    16906      -59     
- Partials     8994     9005      +11     
Files with missing lines Coverage Δ
lib/internal/streams/operators.js 95.39% <100.00%> (-0.75%) ⬇️

... and 37 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@panva panva added the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 7, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 9f7ae86 into nodejs:main Sep 7, 2026
72 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 9f7ae86

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version. stream Issues and PRs related to Node.js streams.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

readable.find()/some()/every() don't destroy the stream on match when the source hasn't ended

9 participants