fix: use HTTP/1.1 for downloads - #3382
Open
gengjiawen wants to merge 1 commit into
Open
gengjiawen wants to merge 1 commit into
gengjiawen wants to merge 1 commit into
Conversation
undici 8 (nodejs#3330) negotiates HTTP/2 by default, so since v13.0.1 header and node.lib downloads from nodejs.org use HTTP/2. Since then the parallel install tests on Windows intermittently fail with "TypeError: terminated" (ERR_HTTP2_STREAM_ERROR or UND_ERR_RES_CONTENT_LENGTH_MISMATCH), which RetryAgent does not retry. As a defensive mitigation, go back to HTTP/1.1, as node-gyp used before undici 8, for both the direct and the proxy/custom CA dispatchers. The root cause of the truncated HTTP/2 responses is not established. The HTTPS download tests now use a server that also offers HTTP/2 and assert that HTTP/1.1 was negotiated.
Contributor
|
This approach seems to move backwards instead of forwards. Is it a short term solution or do we expect to leave this in place? |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
npm install && npm run lint && npm testpassesDescription of change
Set
allowH2: falseon both dispatchers inlib/download.js(the plainAgentand theEnvHttpProxyAgentused for--proxy/--cafile/proxy env), going back to HTTP/1.1 as node-gyp used before undici 8.This is a defensive mitigation, not a proven root-cause fix.
Why
undici 6 and 7 default to
allowH2: false; undici 8 (#3330, shipped in v13.0.1) defaults totrue, so downloads from nodejs.org have used HTTP/2 since then. Since then, theinstall › paralleltests on Windows intermittently fail with an HTTP/2-only error thatRetryAgentdoes not retry, e.g. windows-11-arm, windows-latest:In Jul–Sep this accounted for 4
windows-11-armand 3windows-latestfailures of the3.14 - 26.xjobs (out of 69 runs). It never showed up on Linux or macOS.Evidence
A/B on the fork, same code except for
allowH2: instrumented loop replaying theinstall › paralleltest for 25 min per job onwindows-11-armandwindows-latest(run 1, run 2):terminated←UND_ERR_RES_CONTENT_LENGTH_MISMATCH. No HTTP/1.1 failures at all.Tests
The two HTTPS tests in
test-download.jsnow usehttp2.createSecureServer({ allowHTTP1: true })and assertreq.httpVersion === '1.1'. Onmainboth fail with'2.0' !== '1.1', so they cover the custom-CA path and the proxy tunnel. The plain-Agentpath can't be exercised against a local TLS server without a trusted CA. I checked manually that it negotiateshttp/1.1with nodejs.org.Not covered here
visual-studio (windows-11-arm, 2022)failing every run is a separate, deterministic issue: ci: use Visual Studio 2026 on windows-11-arm #3380EBUSYinaddon works with renamed host executable: test: avoid EBUSY removing renamed host executable #3381windows-latestoccasionally hitting the 30-minute job timeout is not addressed.If this lands, the check is whether
terminatedfailures disappear from Windows CI; if they keep showing up, HTTP/2 wasn't the cause and this should be revisited.