Skip to content

quic: fixup quic stream variable chunk len#63230

Open
jasnell wants to merge 1 commit into
nodejs:mainfrom
jasnell:jasnell/quic-issue-63216
Open

quic: fixup quic stream variable chunk len#63230
jasnell wants to merge 1 commit into
nodejs:mainfrom
jasnell:jasnell/quic-issue-63216

Conversation

@jasnell
Copy link
Copy Markdown
Member

@jasnell jasnell commented May 10, 2026

Fixes: #63216

@jasnell jasnell added the quic Issues and PRs related to the QUIC implementation / HTTP/3. label May 10, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/quic

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels May 10, 2026
@jasnell jasnell changed the title quic: fiup quic stream variable chunk len quic: fixup quic stream variable chunk len May 10, 2026
Signed-off-by: James M Snell <jasnell@gmail.com>
@jasnell jasnell force-pushed the jasnell/quic-issue-63216 branch from a560a10 to 4ade24f Compare May 10, 2026 20:38
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.04%. Comparing base (facd71e) to head (4ade24f).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #63230   +/-   ##
=======================================
  Coverage   90.04%   90.04%           
=======================================
  Files         713      713           
  Lines      224950   224961   +11     
  Branches    42530    42527    -3     
=======================================
+ Hits       202548   202559   +11     
+ Misses      14188    14180    -8     
- Partials     8214     8222    +8     
Files with missing lines Coverage Δ
lib/internal/quic/quic.js 100.00% <100.00%> (ø)

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

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@jasnell jasnell requested review from Qard and pimterry May 11, 2026 02:26
Comment thread lib/internal/quic/quic.js
// while(!writeSync) { dp(); await } loop would spin
// synchronously and starve the event loop.
if (len > stream.#state.writeDesiredSize) {
drainWakeup ??= PromiseWithResolvers();
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.

This will still stall the connection if it ever happens when there's no other writes or acks pending.

This line will set drainWakeup, which blocks all future writes until unset, and it's only ever unset on completed writes or received acks. For the very first write, or any later write if there's no pending acks, it'll never get unset. Ditto for writeev below.

Mainly happens if you're writing chunks larger than highWaterMark, but I think it can happen for smaller cases too depending on QUIC window behaviour.

Comment thread src/quic/streams.cc
// classic 0-to-positive transition and the case where writeDesiredSize
// was already positive but too small for the next chunk. The JS drain
// handler is a no-op when no drainWakeup is pending, so the extra
// callbacks when nobody is waiting are harmless.
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.

Nit: 'harmless' isn't totally true - we still do some non-trivial work to jump into JS and back here every time this fires, and this changes makes that happen very frequently (basically every ack). Not critical, but it'd be easy to avoid this call when we know we don't have a pending drain, might be a nice optimization later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. quic Issues and PRs related to the QUIC implementation / HTTP/3.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quic: stream stalls with chunks of varying sizes

3 participants