fix(net): apply socketTimeout from socket creation in httpRequest - #42660
Conversation
request.setTimeout() only takes effect after the socket connects, so on a stalled TCP connect the default agent's 5s timeout killed the request while the error still reported the configured timeout. This made PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT ineffective for browser downloads on networks where connecting to the CDN takes longer than 5s. Fixes: microsoft#42578
|
Do you have an idea why this fixes the "1.63 regression"? |
|
Yes — it took a while to pin down, because nothing in the diff touches anything version-specific. The mechanism is buried in Node. Node's default agents ( Before 1.63 this never mattered, because On a network where the TCP connect to the CDN takes more than 5s — say the first address in the race is blackholed, which is what the #42597 logs show — the agent timer fires mid-connect, and Playwright's callback reports whatever value it was configured with. Hence that debug log: I reproduced it hermetically: lookup returns a blackholed address first and a working one second, server accepts but never responds. Without the fix the request dies at ~5s while claiming 60s; with it, it survives to the configured timeout. That's what the new test pins down. One-line version: setting |
Test results for "MCP"3 failed 8345 passed, 1376 skipped Merge workflow run. |
Test results for "tests 1"7 flaky51557 passed, 1247 skipped Merge workflow run. |
14c2dcf
into
microsoft:main
…on in httpRequest
request.setTimeout()only takes effect after the socket connects, so on a stalled TCP connect the default agent's built-in 5s timeout killed the request while the error still reported the configured value — e.g. debug logs showedtimed out after 120000msfiring at+5s, andPLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUThad no effect (see [Bug]: Browser Install Timeout regardless of env timeout. 1.63.0 regression #42597)socketTimeoutvia request options so it governs the socket from creation; regression-tested with a stalled-connect case (fails at ~5s before the fix) and a stalled-response caseFixes #42578
Fixes #42597