Repository navigation
fix(redis): connect timeout, no socket left after a failed AUTH, single-flight connect (#1307) - #1319
Merged
Merged
Conversation
…le-flight connect (#1307) - The TCP and TLS connect take a timeout (10 s, as PostgreSQL and MySQL), and so does AUTH / PING, so an unresponsive host no longer holds the caller for the OS timeout. - A failed attempt closes its socket; before, every wrong password left one open. - Concurrent connect() calls share one attempt: one socket, one tunnel.
…mer (#1307) Socket.connect with a timeout creates a timer; widget tests that open a Redis view and end with the connect pending failed on it. The default limit is a test seam (zero: no limit) set by flutter_test_config; tests of the limit pass their own.
3 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 #1307
Problem (
redis_connection.dart)AUTHorPINGthrew, the failure path only cleared_conn/_command; the socket stayed open, anddisconnect()closes onlyif (wasConnected). Each failed attempt (each Test Connection with a wrong password) left a socket.connect()was not single-flight: two concurrent callers opened two sockets and two SSH tunnels, and the second overwrote the first's connection.Fix
Socket.connect/SecureSocket.connectwithconnectTimeout(default 10 s, a constructor parameter), then handed to the client withconnectWithSocket(already what the TLS path did).AUTH+PINGrun under the same timeout.connect()shares an in-flight attempt, as inPostgresConnection/MysqlConnection.Tests (
redis_connect_lifecycle_test.dart, with a small RESP server): a wrong password is an authentication failure and the server sees the socket closed; a server that accepts and never answers fails with a timeout error and is closed; two concurrent connects open one connection; a failed attempt can be retried.