Skip to content

[v7.x] fix: skip reconnecting for aborted requests (#5846) - #6004

Merged
mcollina merged 1 commit into
nodejs:v7.xfrom
mrityunjay-pandey:fix/v7-skip-reconnect-aborted
Nov 20, 2026
Merged

mcollina merged 1 commit into
nodejs:v7.xfrom
mrityunjay-pandey:fix/v7-skip-reconnect-aborted

Conversation

@mrityunjay-pandey

Copy link
Copy Markdown
Contributor

This relates to...

Backport of #5846 (fixes #5845 on main) to v7.x. Companion to #6003, which does the same for v6.x.

Rationale

v7.x has the same spurious reconnect that #5845 describes. When a request is aborted while its response body is still streaming, onHttpSocketClose makes the aborted request pending again, and _resume calls connect(client) before it looks at request.aborted. The client opens a second connection to the origin only to drop the request right after connecting.

The regression test from #5846 fails on current v7.x (0c74bec7): it observes 2 connections where 1 is expected.

Changes

Features

N/A

Bug Fixes

  • client: an aborted request at the head of the pending queue is dropped before connecting, so aborting a streaming response no longer opens a new connection.

Breaking Changes and Deprecations

N/A

Status

Tested locally on Linux with Node 24: test/issue-5845.js fails before the change and passes after it; eslint, test/fetch/*.js (456 pass), test/node-test/** (231 pass) and test/interceptors/*.js (311 pass) all pass. In test/*.js, 1316 tests pass and 0 fail; test/issue-4880.js (the h2 high-concurrency test) timed out when the whole suite ran in parallel on my 2-vCPU machine, and passes when run on its own, both with and without this change. I did not run the wpt, websocket or jest suites locally.

Fixes: nodejs#5845

Signed-off-by: Junaid-PK <junaidhussnain369@gmail.com>
(cherry picked from commit fcdd5a6)
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.11%. Comparing base (0c74bec) to head (90bda15).
⚠️ Report is 42 commits behind head on v7.x.

Additional details and impacted files
@@            Coverage Diff             @@
##             v7.x    #6004      +/-   ##
==========================================
- Coverage   93.11%   93.11%   -0.01%     
==========================================
  Files         112      112              
  Lines       37366    37371       +5     
==========================================
+ Hits        34793    34797       +4     
- Misses       2573     2574       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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 merged commit fc79f9b into nodejs:v7.x Nov 20, 2026
32 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants