Skip to content

http2: release memory credit for canceled writes - #66784

Open
fatihguzeldev wants to merge 1 commit into
nodejs:mainfrom
fatihguzeldev:http2-cancelled-upload-memory
Open

fatihguzeldev wants to merge 1 commit 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

@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?

@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.69%. Comparing base (38aa1f3) to head (e02ea14).
⚠️ Report is 283 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66784      +/-   ##
==========================================
+ Coverage   90.49%   90.69%   +0.20%     
==========================================
  Files         797      797              
  Lines      277503   278898    +1395     
  Branches    53329    53626     +297     
==========================================
+ Hits       251124   252960    +1836     
+ Misses      16785    16299     -486     
- Partials     9594     9639      +45     

see 140 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
@inoway46

inoway46 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

@fatihguzeldev Sorry, I missed this PR when working on #67113, which has now landed with the same fix.

The partial-send and write-callback destruction cases here add useful coverage beyond the landed test. I verified that your tests pass with my local main build. Would you be interested in updating this PR to keep the tests and drop the C++ changes?

@fatihguzeldev

Copy link
Copy Markdown
Author

@inoway46 well, that's one way to get my fix into main. would've preferred to land it through this PR, especially since it was already open and approved. let's coordinate a bit better next time so we don't end up here again.

i'll update this one to keep the extra tests and drop the rest. thanks for checking.

@fatihguzeldev

Copy link
Copy Markdown
Author

@pimterry you approved #66784 on october 28, and i addressed the formatting feedback that day. #67113 was opened the following day with the exact same two-line C++ fix. you then approved and queued that PR while #66784 was still open.

why was the later PR taken forward instead of the earlier one you had already reviewed and approved? i've updated #66784 to keep the additional tests, but i'd like to understand how that decision was made.

@pimterry

pimterry commented Nov 2, 2026

Copy link
Copy Markdown
Member

Hi @fatihguzeldev. Sorry about that, not intentional. There's a lot going on right now and I didn't realise.

@pimterry pimterry 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.

Happy to land this for the extra test coverage. Would you mind squashing the commits into one, with an updated commit message covering the tests specifically? The commit message will become the addition in the changelog once it's merged.

@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 2, 2026
Cover session reuse after canceling queued uploads, including partial
sends and destruction from a write callback. Verify that another
stream remains usable after cancellation.

Signed-off-by: Fatih Güzel <fatihguzeldev@gmail.com>
@fatihguzeldev
fatihguzeldev force-pushed the http2-cancelled-upload-memory branch from 9ded7bd to e02ea14 Compare November 3, 2026 08:03
@fatihguzeldev

Copy link
Copy Markdown
Author

@pimterry done.

@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 Nov 3, 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 3, 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: canceled upload leaves session memory accounting over budget

4 participants