Repository navigation
conncache: poll an idle connection for pending input on every reuse (backport) - #62
Open
fadedreamz wants to merge 1 commit into
Open
fadedreamz wants to merge 1 commit into
fadedreamz wants to merge 1 commit into
Conversation
Backport of upstream ef6b17c (curl#23412), adapted to 8.22.0: upstream's cpool_conn_can_be_closed() is spelled out as !CONN_INUSE(conn) && !conn->bits.connect_only. Since 2f1e94e the alive check is skipped when it ran less than a second ago, which also skipped the pending input check. An idle HTTP/1.1 connection closed by the server was then reused within that second; the request failed, curl retried on a fresh connection and had to rewind the upload, which fails for a paused, non-seekable streaming upload (CURLE_SEND_FAIL_REWIND). Poll for pending input on every reuse of an idle non-multiplexed connection, as 8.20 did. (cherry picked from commit ef6b17c)
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.
Backport of upstream curl/curl@ef6b17cf12 (curl#23412). It's on upstream
masterafter 8.23.0 and will first ship in 8.24.0.Problem
curl 8.22.0 (upstream 2f1e94e) skips the connection alive check if it ran less than a second ago. Returning a connection to the pool counts as a check. So an idle HTTP/1.1 connection the server has closed is handed out as healthy within that second:
Curl_retry_request) and must rewind the upload.CURL_READFUNC_PAUSEand has no seek support, the rewind fails withCURLE_SEND_FAIL_REWIND("seek callback returned error 2").In Unity this breaks
HttpHandlerBehaviors.SendAsync_{Get,Put}WithLateWrittenBody_ServerReceivesFullBodyon iOS. They pass with curl 8.20 (Yamato 77970446) and fail with 8.22 (Yamato 77880251).Change
Poll for pending input on every reuse of an idle, non-multiplexed connection, as 8.20 did. The once-a-second limit stays for multiplexed connections and protocols with their own
connection_is_dead.Adapted to 8.22.0: upstream's
cpool_conn_can_be_closed(conn)is spelled out as!CONN_INUSE(conn) && !conn->bits.connect_only. Upstream test 1701 is included.Verification
🤖 Generated with Claude Code