Treat EINVAL from TCP_NODELAY as a closed connection - #176
Merged
Merged
Conversation
macOS rejects setsockopt with EINVAL once the peer has reset the connection. When this happened while sending request headers on a reused connection, the client saw "Invalid argument", which is-close-exception_ doesn't recognize, so the request wasn't retried even with --retry-on-connection-close. This made client-request-retry-test flaky on macOS. Route both TCP_NODELAY changes in send-headers through a helper that reports this error as "Connection closed". The existing cleanup still closes the connection.
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.
macOS rejects
setsockoptwith EINVAL once the peer has reset the connection. When this happened while sending request headers on a reused connection, the client sawInvalid argument, whichis-close-exception_doesn't recognize, so the request wasn't retried even with--retry-on-connection-close.This made
client-request-retry-testflaky on macOS (seen on #174: https://github.com/toitlang/pkg-http/actions/runs/37032094927/job/110921188938).Both TCP_NODELAY changes in
send-headersnow go through a helper that reports this error asConnection closed. Other errors propagate unchanged, and the existing cleanup from #172 still closes the connection.Not reproducible on Linux; the macOS CI run is the real check.