Repository navigation
fix(mysql): forceClose and disconnect during connect end the attempt (#1313) - #1326
Merged
Merged
Conversation
…1313) forceClose returned before releasing the SSH tunnel when there was no connection object yet, and the attempt it overtook finished as a connected session. An attempt now notes the generation it started in; when disconnect or forceClose bumped it, the attempt closes what it opened, releases its tunnel and fails, and a connect after a forceClose starts a new attempt instead of joining the overtaken one.
2 tasks
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.
Closes #1313
Problem (
mysql_connection.dart)forceClosedidif (c == null) return;before releasing the SSH handle. Called whileconnect()was between opening the tunnel and creating the driver connection, it left the tunnel's reference counted for good._isConnected = true: the interrupted session came back connected. PostgreSQL'sforceClosehandles both._connectingstill held the overtaken attempt, so aconnect()after aforceClosejoined it.Fix
_generation, bumped bydisconnectandforceClose(which also clear_connecting)._connectOncerecords it, checks it after the tunnel opens and after the handshake; when it changed, it closes the driver connection and releases the tunnel it opened (the fields may belong to a newer attempt), and fails withStateError('The connection was closed while it was being opened').forceCloseno longer returns early: the tunnel is released whether or not there was a connection.Tests (
mysql_connect_cancel_test.dart, fake SSH server with a connect delay):forceCloseanddisconnectduring the tunnel's opening end the attempt within the tunnel's time (not after the 6 s handshake wait), leave it not connected and the tunnel session count at zero; a connect after aforceCloseis a new attempt.