Skip to content

http2: release memory credit for canceled writes - #66784

Open
fatihguzeldev wants to merge 2 commits into
nodejs:mainfrom
fatihguzeldev:http2-cancelled-upload-memory
Open

fatihguzeldev wants to merge 2 commits into
nodejs:mainfrom
fatihguzeldev:http2-cancelled-upload-memory

Conversation

@fatihguzeldev

Copy link
Copy Markdown

when an upload was canceled, its queued data was discarded but still counted toward the session's memory limit. that could make later requests on the same session fail with NGHTTP2_ENHANCE_YOUR_CALM.

cleanup now subtracts those bytes before running the write callbacks. the test checks both cancellation by the server and destroy() from a write callback.

Fixes: #66742

Canceled uploads left unsent bytes charged to the session,
causing later requests to fail with NGHTTP2_ENHANCE_YOUR_CALM.

Release the remaining credit during deferred cleanup, before
running write callbacks.

Signed-off-by: Fatih Güzel <fatihguzeldev@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @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 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

@pimterry

Copy link
Copy Markdown
Member

Hi @fatihguzeldev, the core change here looks good but the CPP linting is failing, can you take a look?

Signed-off-by: Fatih Güzel <fatihguzeldev@gmail.com>
@fatihguzeldev

Copy link
Copy Markdown
Author

@pimterry thanks for the review, fixed the formatting.

@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.66%. Comparing base (38aa1f3) to head (792306c).
⚠️ Report is 201 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66784      +/-   ##
==========================================
+ Coverage   90.49%   90.66%   +0.17%     
==========================================
  Files         797      797              
  Lines      277503   278485     +982     
  Branches    53329    53563     +234     
==========================================
+ Hits       251124   252495    +1371     
+ Misses      16785    16344     -441     
- Partials     9594     9646      +52     
Files with missing lines Coverage Δ
src/node_http2.cc 82.14% <100.00%> (+0.11%) ⬆️

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

@pimterry pimterry 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 Oct 28, 2026
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. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

http2: canceled upload leaves session memory accounting over budget

3 participants