You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Outbound fetch fails when a pooled keep-alive connection is closed by the server (flaky fetch/misc@all-autogates) #8100
//src/wpt:fetch/misc@all-autogates fails intermittently, mostly on the ARM debug job, in cross-origin-resource-policy/syntax.any.js ("Parsing Cross-Origin-Resource-Policy: same"):
Since 9d81827 ("server: reuse outbound connections", #7714), the kj-hyper client (src/rust/cxx/kj-hyper/client.rs) keeps connections in hyper-util's legacy pool.
The previous test, content-length/api-and-duplicate-headers.any.js, fetches resources/identical-duplicates.asis. wptserve's AsIsHandler writes the file's bytes as the response, an HTTP/1.1 response with Content-Length: 6 and no Connection: close. Then it sets close_connection = True and closes the socket.
hyper sees a complete keep-alive response and returns the connection to the pool.
In our harness HTTP_REMOTE_ORIGIN is the same as HTTP_ORIGIN (src/wpt/harness/common.ts), so syntax.any.js's first fetch, a few ms later, checks out the same connection.
If hyper has not yet seen the server close the socket, it writes the request onto it and gets EOF instead of a response. hyper-util retries only requests it never wrote (TrySendError::Retryable / retry_canceled_requests), so this one ends as a SendRequest error.
This isn't specific to WPT. Any origin that closes idle keep-alive connections without Connection: close, for example a server whose keep-alive timeout is shorter than our 5 s idle_timeout, can fail a request this way. Before 9d81827, every request used a new connection.
Possible fix
Retry once, as browsers do, when a replayable request (an empty GET/HEAD, which request() already treats as unframed) fails on a reused connection before any response bytes arrive. hyper-util's error doesn't say whether the connection was reused. One way to track it is a per-connection marker attached with Connected::extra(): a received response sets it, and on error it's read back with err.connect_info() + Connected::get_extras().
To make it deterministic in a kj-hyper test, have the server answer one request, then read the next request and close without responding.
A test-only workaround is to make the sidecar send Connection: close for .asis responses. That would leave the production race in place.
@npaun I think I will try to address it right now, I'm hitting it very frequently on CI today.... actually it's a different problem, so this one is up for grabs
Verified with workerd 1.20261119.1: GET and HEAD requests recover when a reused keep-alive connection closes without responding. A deterministic reproduction passed 40 retries across compatibility dates 2026-10-30 and 2026-11-19, with server logs confirming retries used fresh connections. Closing as resolved.
Activity
npaun commentedon Oct 30, 2026
I assigned us both just so it comes up when I look at issues I'm interested in. Hopefully that's not going to do anything annoying in your workflow
bartlomieju commentedon Oct 30, 2026
@npaun I think I will try to address it right now, I'm hitting it very frequently on CI today....actually it's a different problem, so this one is up for grabsbartlomieju commentedon Nov 20, 2026
Verified with workerd 1.20261119.1: GET and HEAD requests recover when a reused keep-alive connection closes without responding. A deterministic reproduction passed 40 retries across compatibility dates 2026-10-30 and 2026-11-19, with server logs confirming retries used fresh connections. Closing as resolved.