Skip to content

fix(h1): backport ignore type of service errors to v7.x (#5547) - #6076

Merged
mcollina merged 1 commit into
v7.xfrom
backport-5547-to-v7.x
Oct 27, 2026
Merged

mcollina merged 1 commit into
v7.xfrom
backport-5547-to-v7.x

Conversation

@mcollina

Copy link
Copy Markdown
Member

Backports #5547 ("fix(h1): ignore type of service errors") to the v7.x branch.

socket.setTypeOfService() is best-effort QoS marking and can throw synchronously on some platforms (e.g. EINVAL on macOS when a connection is reset before the first write), which previously crashed the process via an uncaught exception. This backport skips the call when no typeOfService was requested, tracks the last applied value to avoid redundant calls, and ignores synchronous failures so they do not abort requests.

Closes #6075.

@codecov-commenter

codecov-commenter commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.20690% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.15%. Comparing base (0eec414) to head (2bdc6c1).

Files with missing lines Patch % Lines
lib/dispatcher/client-h1.js 85.71% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             v7.x    #6076      +/-   ##
==========================================
- Coverage   93.16%   93.15%   -0.01%     
==========================================
  Files         112      112              
  Lines       37632    37657      +25     
==========================================
+ Hits        35059    35080      +21     
- Misses       2573     2577       +4     

☔ 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 requested review from metcoder95 and ronag October 23, 2026 16:22
Backport of #5547 (fix(h1): ignore type of service errors) to v7.x.

- Skip setTypeOfService(0) for fresh HTTP/1.1 sockets when typeOfService was not explicitly provided.
- Track the last ToS value applied to each socket and avoid redundant calls.
- Reset a reused socket back to ToS 0 after an explicitly prioritized request.
- Ignore synchronous setTypeOfService() failures so they do not abort requests or crash the process.

Closes #6075.
@mcollina
mcollina force-pushed the backport-5547-to-v7.x branch from da1df6d to 2bdc6c1 Compare October 24, 2026 20:30
@mcollina
mcollina merged commit 37bc295 into v7.x Oct 27, 2026
37 checks passed
@mcollina
mcollina deleted the backport-5547-to-v7.x branch October 27, 2026 09:36
@github-actions github-actions Bot mentioned this pull request Nov 5, 2026
wallforfry added a commit to wallforfry/liasse that referenced this pull request Nov 16, 2026
* test(server): probe the closed listener over TCP, not fetch

The shutdown test polled /health with fetch until the listener refused
connections. A connection still queued when the listener closes is reset
by the kernel; the undici bundled with Node 24.18 (7.28.0) then calls
setTypeOfService on it in its connect callback, which throws EINVAL on
macOS as an uncaught exception, outside the request. Fixed upstream in
nodejs/undici#5547, backported to 7.x by nodejs/undici#6076, not yet in
Node 24.

Probe the port with a bare net socket that handles its own errors, and
count only ECONNREFUSED as closed.

Closes #67

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wallerand Delevacq <[email protected]>

* test(server): bound each listener probe by the step timeout

Like the fetch poll it replaced, a probe that hangs is abandoned after
STEP_TIMEOUT_MS and counts as a probe to repeat, so it cannot outlive the
deadline of waitUntil.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wallerand Delevacq <[email protected]>

---------

Signed-off-by: Wallerand Delevacq <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

3 participants