Skip to content

http2: exclude queued data from response memory checks - #67114

Open
inoway46 wants to merge 1 commit into
nodejs:mainfrom
inoway46:fix-http2-final-response-memory
Open

inoway46 wants to merge 1 commit into
nodejs:mainfrom
inoway46:fix-http2-final-response-memory

Conversation

@inoway46

@inoway46 inoway46 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

A server can reject a request with an early response, such as 413 Payload Too Large, while the request body is still queued on the client. If that queued data exhausts maxSessionMemory, the client rejects the response headers with ERR_HTTP2_STREAM_ERROR instead of delivering the response to the application.

Exclude session-wide queued outbound DATA from incoming header memory checks on locally initiated client streams, including informational responses and trailers. This allows the client to receive the response while the request body remains queued, provided the remaining counted memory stays within the session budget. This follows the client-side, locally initiated stream scope suggested in #66739 (comment), while retaining memory checks for received headers.

Retained headers, including informational responses, still count towards the session budget. Repeated 1xx responses therefore remain subject to the cumulative header memory limit. Header count and size limits, server-side checks, push stream checks, and new stream admission are unchanged.

Add regression coverage for early responses, informational responses, trailers, retained headers, and header limits. Strengthen the cancellation test to verify memory accounting cleanup through subsequent push admission.

Fixes: #66739
Refs: #67113

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/http2
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. http2 Issues and PRs related to the http2 subsystem. needs-ci PRs that need a full CI run. labels Oct 29, 2026
@inoway46
inoway46 force-pushed the fix-http2-final-response-memory branch 2 times, most recently from 0edc48e to c90f4ac Compare October 31, 2026 17:30
@inoway46 inoway46 changed the title http2: exclude queued data from final response memory checks http2: exclude queued data from response memory checks Nov 1, 2026
@inoway46
inoway46 force-pushed the fix-http2-final-response-memory branch from c90f4ac to 0f87053 Compare November 1, 2026 03:39
Allow clients to receive responses when queued request data exceeds
maxSessionMemory, while preserving limits on received headers.

Fixes: nodejs#66739
Refs: nodejs#67113
Assisted-by: Codex
Signed-off-by: inoway46 <[email protected]>
@inoway46
inoway46 force-pushed the fix-http2-final-response-memory branch from 0f87053 to 151b1b8 Compare November 1, 2026 03:51
@inoway46
inoway46 requested a review from pimterry November 1, 2026 04:13
@inoway46
inoway46 marked this pull request as ready for review November 1, 2026 04:14
@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.69%. Comparing base (80a74e1) to head (151b1b8).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67114      +/-   ##
==========================================
+ Coverage   90.67%   90.69%   +0.01%     
==========================================
  Files         797      797              
  Lines      278789   278805      +16     
  Branches    53609    53618       +9     
==========================================
+ Hits       252798   252860      +62     
+ Misses      16342    16306      -36     
+ Partials     9649     9639      -10     
Files with missing lines Coverage Δ
src/node_http2.cc 82.11% <100.00%> (+0.01%) ⬆️
src/node_http2.h 92.96% <100.00%> (+0.49%) ⬆️

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

@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 Nov 1, 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 Nov 1, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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++. http2 Issues and PRs related to the http2 subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

http2: large queued request body prevents receiving an early response

3 participants