fix: preserve timeout errors for HTTP/2 requests by mcollina · Pull Request #5091 · nodejs/undici (original) (raw)
Fixes #5087
Description
Preserve documented timeout error semantics for HTTP/2 requests by:
- using
headersTimeoutuntil response headers arrive - switching to
bodyTimeoutonce the response starts - rejecting with
HeadersTimeoutError/UND_ERR_HEADERS_TIMEOUTwhen headers time out over h2 - rejecting with
BodyTimeoutError/UND_ERR_BODY_TIMEOUTwhen the response body stalls over h2
This also restores RetryAgent({ errorCodes: ['UND_ERR_BODY_TIMEOUT'] }) behavior for HTTP/2 requests.
Tests
./node_modules/.bin/borp --timeout 180000 -p "test/issue-5087.js"./node_modules/.bin/borp --timeout 180000 -p "test/http2-timeout.js"npm run test:h2:core./node_modules/.bin/eslint lib/dispatcher/client-h2.js test/issue-5087.js
Codecov Report
❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.21%. Comparing base (cc793b7) to head (099d5e6).
⚠️ Report is 1 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| lib/dispatcher/client-h2.js | 94.44% | 1 Missing ⚠️ |
Additional details and impacted files
@@ Coverage Diff @@ ## main #5091 +/- ##
Coverage 93.23% 93.21% -0.02%
Files 110 110
Lines 36599 36607 +8
- Hits 34122 34124 +2
- Misses 2477 2483 +6
☔ View full report in Codecov by Sentry.
📢 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.
Anything I can do to help here? I could fork this branch, handle the conflicts (maybe 😅), and look into the Windows issues. Just didn't want to do all the ceremony if it's in active dev.
Signed-off-by: Matteo Collina hello@matteocollina.com
…set headersTimeout, expect HeadersTimeoutError)
mcollina deleted the fix/5087-h2-timeout-errors branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})