Repository navigation
Clear transport deadlines when set_timeouts! changes the timeouts - #259
Merged
Merged
Conversation
After a command runs under 1 s read and write timeouts, lowering them to 0 and waiting 1.5 s must not fail the next command. On main it fails with TimeoutError (phase READY) and closes the connection (#257). Co-Authored-By: Claude Opus 5.5 <[email protected]>
A per-operation timeout of 0 arms nothing before a read or write, so after set_timeouts!(s, 0, 0) the deadline armed under the previous timeouts stayed on the transport. Once it passed, the next statement failed with TimeoutError and the connection closed. set_timeouts! now clears both transport deadlines when the session is open. connect no longer clears the establishment deadline separately, because the set_timeouts! call that follows it does. Fixes #257 Co-Authored-By: Claude Opus 5.5 <[email protected]>
quinnj
approved these changes
Nov 11, 2026
quinnj
left a comment
Member
There was a problem hiding this comment.
[review generated via AI]
Approving. An independent check reproduced #257 on main: the new testset fails there, because a timeout set to 0 still left a deadline armed. On this head the protocol suite passes 1791/1791, and the full suite with the live MySQL 8.4 lanes passes 2305/2305, over plain TCP and TLS.
Merged
quinnj
referenced
this pull request
Nov 11, 2026
Co-authored-by: Jacob Quinn <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Why
After
MySQL.Protocol.set_timeouts!(s, 0, 0), the deadline that the previous timeouts armed stays on the transport. Once it passes, the next statement fails withTimeoutErrorand the connection closes (#257). A pool that bounds a health-check ping withset_timeouts!and then restores 0 hits this on the next statement.What changed
set_timeouts!clears the transport's read and write deadlines when the session is open. A non-zero timeout re-arms its own deadline before the next read or write, and a 0 timeout leaves none.connectno longer clears the connection-establishment deadline itself, because theset_timeouts!call that follows it now does.Fixes #257
Scope
set_timeouts!:connectand code that sets the timeouts later on an open connection.connect_timeoutdeadline.wait_for_notification, is cleared in afinally.Blast Radius
Only
set_timeouts!and the end ofconnectchange. A caller that set an absolute deadline on the transport and then calledset_timeouts!now loses that deadline. No code in the package does this;connectcleared its deadline at that point anyway.Verification
TimeoutError ... (phase READY)andisopen(conn) == false. With this branch: the secondSELECT 1succeeds and the connection stays open. A probe of the transport's armed deadlines shows them at 0 afterset_timeouts!(s, 0, 0); on main they stayed at about now + 1 s.Protocol.set_timeouts!(s, 0, 0)leaves the last armed read/write deadline in force; the next statement fails withTimeoutError#257)". It fails on main with the sameTimeoutErrorfromflush_command!, and passes here. Protocol suite on Julia 1.12.6: 1791/1791.connect_timeout=1with and withoutread_timeout/write_timeout, over TCP and TLS against MySQL 8.4.13: a statement 1.5 s after connect succeeds, so the establishment deadline is still cleared.connect(sessionREADY, so the clear runs). A closed or broken session skips the clear, because setting a deadline on a closed Reseau descriptor throws. The arm functions and their zero-cost default path are unchanged.🤖 Generated with Claude Code