FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

stream: prevent dead lock when Duplex generator is "thrown" by matthieusieben · Pull Request #56287 · nodejs/node · GitHub

/ node Public

stream: prevent dead lock when Duplex generator is "thrown" - #56287

Open
matthieusieben wants to merge 1 commit into
nodejs:mainfrom
matthieusieben:fix-56278
Open

stream: prevent dead lock when Duplex generator is "thrown"#56287
matthieusieben wants to merge 1 commit into
nodejs:mainfrom
matthieusieben:fix-56278

Conversation

matthieusieben commented Dec 17, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

Fixes regression introduced in #55096 and outlined in #56278.

When using a for await loop, v8 (?) might call the .throw function of the iterable instead of the stream handlers (write, final, destroy). This can cause a dead lock as this line waits for a promise that will never be resolved (since the promise is setteled from the stream handlers).

This PR adresses that issue by making sure the promise is resolved whenever the generator's return and throw function are called, preventing the dead lock.

cc @jakecastelli

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

nodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem. labels Dec 17, 2024

codecov Bot commented Dec 17, 2024
edited
Loading

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.54%. Comparing base (5ad2ca9) to head (361bc6c).
⚠️ Report is 4355 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/streams/duplexify.js 83.33% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #56287      +/-   ##
==========================================
- Coverage   88.54%   88.54%   -0.01%     
==========================================
  Files         657      657              
  Lines      190285   190311      +26     
  Branches    36539    36540       +1     
==========================================
+ Hits       168490   168509      +19     
- Misses      14974    14984      +10     
+ Partials     6821     6818       -3     
Files with missing lines Coverage Δ
lib/internal/streams/duplexify.js 96.00% <83.33%> (-1.17%) ⬇️

... and 38 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.

jakecastelli commented Dec 17, 2024
edited
Loading

Copy link
Copy Markdown
Member

I believe #55096 could potentially cause a massive breakage in the eco-system - as I found out thru some of the user land applications / packages on nightly build. I'd suggest we revert 55096 and open another PR along with the fix in this PR and run a CITGM, so we can be more assured.

Update: actually Robert has added the don't land labels on the PR

cc. @nodejs/streams

jakecastelli added needs-citgm PRs that need a CITGM CI run. blocked PRs that are blocked by other issues or PRs. labels Dec 18, 2024

Copy link
Copy Markdown
Member

@jakecastelli @matthieusieben is this PR solves the breakage introduced?

I agree with @jakecastelli, a quick revert is better.

Copy link
Copy Markdown
Member

Is this PR solves the breakage introduced?

At least it passes the test that I found thru the broken user land application. There are a few potential cases I will need to look into during holidays.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm

jakecastelli removed the blocked PRs that are blocked by other issues or PRs. label Dec 24, 2024
mcollina added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 28, 2024
nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Dec 28, 2024

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/56287
✔  Done loading data for nodejs/node/pull/56287
----------------------------------- PR info ------------------------------------
Title      stream: prevent dead lock when Duplex generator is "thrown" (#56287)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     matthieusieben:fix-56278 -> nodejs:main
Labels     stream, needs-ci, needs-citgm
Commits    1
 - stream: prevent dead lock when Duplex generator is "thrown"
Committers 1
 - Matthieu Sieben <matthieu.sieben@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/56287
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/56287
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Tue, 17 Dec 2024 12:57:50 GMT
   ✔  Approvals: 2
   ✔  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/56287#pullrequestreview-2521954662
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/56287#pullrequestreview-2524628246
   ⚠  This PR has conflicts that must be resolved
   ✔  Last GitHub CI successful
   ✘  No Jenkins CI runs detected
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/12527396373

Copy link
Copy Markdown
Member

Can you resolve the conflicts?

jakecastelli 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The resolution LGTM, but I am explicitly requesting changes as this PR has not yet run CI and CITGM. I will follow up once the merge conflict is resolved.

jakecastelli removed the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Dec 28, 2024
mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 28, 2024
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 28, 2024

Copy link
Copy Markdown
Collaborator

mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 30, 2024

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm

github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 30, 2024

Copy link
Copy Markdown
Collaborator

jakecastelli 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Do you mind resolving the conflicts? so we can push this work forward

Copy link
Copy Markdown
Contributor Author

Hello,

I'm sorry but I don't have much bandwidth at the moment. I do still want this in so I'll try to find some time in the near future.

Ethan-Arrowood commented Jul 15, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Hello, I'm doing some backlog hygiene on all PRs related to networking and streaming modules. There hasn't been any activity here for quite a while so I'm going to mark it stalled. It will auto-close in ~30 days. This is not a rejection; if you've like to pick it back up, rebase onto latest main and give me a ping.

Thank you!

Side note: this looked to be very close to making it over the finish line before. Just need to resolve the merge conflicts and I think this is a valuable contribution.

Ethan-Arrowood added the stalled Issues and PRs that are stalled. label Jul 15, 2026

Copy link
Copy Markdown
Contributor

This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open.

github-actions Bot removed the stalled Issues and PRs that are stalled. label Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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. needs-citgm PRs that need a CITGM CI run. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL