Skip to content

fix(h1): ignore type of service errors#5547

Merged
mcollina merged 2 commits into
mainfrom
fix-h1-type-of-service-crash
Jul 12, 2026
Merged

fix(h1): ignore type of service errors#5547
mcollina merged 2 commits into
mainfrom
fix-h1-type-of-service-crash

Conversation

@mcollina

Copy link
Copy Markdown
Member

This relates to...

Fixes #5544.

Rationale

socket.setTypeOfService() is best-effort QoS marking. It can throw synchronously on some platforms depending on socket state, and the default request path should not touch it when no ToS value was explicitly requested.

Changes

Features

N/A

Bug Fixes

  • 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.
  • Add regression coverage for default requests and thrown setTypeOfService() errors.

Breaking Changes and Deprecations

N/A

Status

Tested with:

  • npx borp -p "test/ip-prioritization.js"
  • npm run lint

@codecov-commenter

codecov-commenter commented Jul 11, 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.44%. Comparing base (c7c7e7f) to head (794f99f).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
lib/dispatcher/client-h1.js 85.71% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5547      +/-   ##
==========================================
- Coverage   93.45%   93.44%   -0.01%     
==========================================
  Files         110      110              
  Lines       37376    37443      +67     
==========================================
+ Hits        34928    34987      +59     
- Misses       2448     2456       +8     

☔ 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 197a83d into main Jul 12, 2026
36 checks passed
@mcollina
mcollina deleted the fix-h1-type-of-service-crash branch July 12, 2026 13:13
@github-actions github-actions Bot mentioned this pull request Jul 20, 2026
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.

writeH1 calls socket.setTypeOfService() unconditionally — uncaught EINVAL on macOS crashes the process

3 participants