-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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.
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
stream: prevent dead lock when Duplex generator is "thrown" #56287
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
d8d8b42
to
361bc6c
Compare
Codecov ReportAttention: Patch coverage is
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
|
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 @matthieusieben is this PR solves the breakage introduced? I agree with @jakecastelli, a quick revert is better. |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
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 <[email protected]> PR-URL: https://github.com/nodejs/node/pull/56287 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/56287 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> -------------------------------------------------------------------------------- ℹ 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/.ncuhttps://github.com/nodejs/node/actions/runs/12527396373 |
Can you resolve the conflicts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
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
andthrow
function are called, preventing the dead lock.cc @jakecastelli