quic: remove unused fin flag from blob reader wakeup - #65315
Open
trivenay wants to merge 1 commit into
Open
Conversation
Collaborator
|
Review requested:
|
Member
|
@trivenay ... this will need a rebase |
The fin argument threaded from Blob::Reader::NotifyPull to the JS blob reader iterator was dead: the only consumer, `if (fin) continue;`, was the last statement in the loop and behaved identically to falling through. End-of-stream is always discovered by the subsequent pull returning EOS, never via the wakeup label. Remove the flag from the JS iterator, NotifyPull's signature/argv, and the EndReadable call site. The `!fin` coalescing bypass collapses safely because a parked reader always has pull_pending_ == false, so the first wakeup after parking always fires. Refs: nodejs#64767 Signed-off-by: Naman Trivedi <trivenay@amazon.com>
Contributor
Author
|
Rebased on main — thanks for the heads-up! |
trivenay
force-pushed
the
quic-blob-remove-dead-fin
branch
from
August 16, 2026 09:46
9a01ab0 to
9cbb5e4
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #65315 +/- ##
=======================================
Coverage 90.11% 90.11%
=======================================
Files 752 752
Lines 251569 251560 -9
Branches 47268 47278 +10
=======================================
- Hits 226701 226698 -3
+ Misses 16233 16213 -20
- Partials 8635 8649 +14
🚀 New features to boost your workflow:
|
Contributor
Author
|
The |
Member
|
Just a note, this will have a few conflicts with #65309 but nothing major. |
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
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.
Fixes the dead code identified in #64767.
The blob reader used by QUIC inbound streams has two separate channels. The pull channel is where the iterator asks for data and gets a real answer: a chunk, "blocked, nothing available yet", or "end of stream". The wakeup channel exists only to wake a parked iterator after a blocked pull so it pulls again — it carries no data and answers no question.
The wakeup additionally carried a boolean label saying whether it was triggered by end-of-stream. That label is dead information: whatever it says, the woken iterator does the same single thing — loop back and pull. If the stream has ended, that next pull returns end-of-stream by itself, because the receive queue was already capped when the FIN was processed. The pull channel is the source of truth for "am I done?"; the label was a second announcement of something the very next pull confirms anyway, and the branch consuming it (
if (fin) continue;as the final statement of the loop) behaves identically to not existing.This removes the label end to end while keeping the wakeup itself: the JS iterator no longer reads a value from the wakeup promise, the C++ notifier no longer constructs or passes the boolean, and the end-of-stream path still fires a (now unlabeled) wakeup. All actual FIN processing — recording the final size, capping the receive queue, the stream state flags — is untouched.
One consequence deserves reviewer attention. The notifier coalesces wakeups: once it has woken the iterator, further wakeups are suppressed until the iterator actually pulls. Previously, end-of-stream wakeups bypassed that suppression "just in case". With the label gone the bypass goes too, so end-of-stream wakeups now coalesce like any other. This cannot stall the iterator: the iterator only parks after a pull returned "blocked", every pull resets the suppression flag on entry, and only synchronous JavaScript runs between that pull and the park — so a parked iterator always has suppression clear, and the first wakeup after parking always gets through. The bypass only ever fired while the iterator was already awake and about to pull, where an extra wakeup changes nothing.
Changes:
lib/internal/blob.js— stop reading a value from the wakeup; delete the dead branch and its comment.src/node_blob.cc,src/node_blob.h—NotifyPull()loses its boolean parameter and JS-facing argument.src/quic/streams.cc— the end-of-stream call site drops the argument.No behavior change; no new test. Existing
test/parallel/test-quic-*andtest/parallel/test-blob*pass on the compiled binary.