Repository navigation
Send the CancelRequest before closing the socket - #2
Open
Sanguinor88 wants to merge 1 commit into
Open
Sanguinor88 wants to merge 1 commit into
Sanguinor88 wants to merge 1 commit into
Conversation
When a statement was given up on (a timeout, a cancellation, or a raise from the caller's callback), stop closed the connection first and only then sent the CancelRequest for it. The server saw the session end before the cancel arrived, and a pooling proxy can drop a cancel for a client session that has already disconnected, so the statement went on running for nobody. stop now sends the cancel first and closes the connection in a finally, so the connection is closed whatever the cancel does. The cancel opens a connection of its own and reads nothing from this one's stream, which no exchange reads once it is given up on; it keeps its shield and its bound of 5 s or the timeout, so a caller waits no longer than before, and a failed cancel is still ignored. The new case, 54.2.8 a cancel is sent before the connection closes, has a fake server note whether the session is still open when the CancelRequest arrives. The docs now give the order: cancelled, then closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
When a statement was given up on (a timeout, a cancellation, or a raise from the caller's callback), stop closed the connection first and only then sent the CancelRequest for it. The server saw the session end before the cancel arrived, and a pooling proxy can drop a cancel for a client session that has already disconnected, so the statement went on running for nobody.
stop now sends the cancel first and closes the connection in a finally, so the connection is closed whatever the cancel does. The cancel opens a connection of its own and reads nothing from this one's stream, which no exchange reads once it is given up on; it keeps its shield and its bound of 5 s or the timeout, so a caller waits no longer than before, and a failed cancel is still ignored. The new case, 54.2.8 a cancel is sent before the connection closes, has a fake server note whether the session is still open when the CancelRequest arrives. The docs now give the order: cancelled, then closed.