moguchev opened a new pull request, #1953: URL: https://github.com/apache/cassandra-gocql-driver/pull/1953
Splits previously conflated timeout budgets so a low user-supplied Timeout no longer breaks session establishment, and adds dedicated client-side budgets for system queries and per-request overrides. Also fixes a potential controlConn reconnect deadlock. * ClusterConfig.ReadTimeout: socket-level read deadline, defaults to 11s, falls back to ConnectTimeout if unset. Decoupled from Timeout, which is now purely a per-request client-side budget. * ClusterConfig.Metadata.SystemRequestTimeout (default 60s): per-request budget for system/system_schema queries and other runtime control-conn frames. Applied via Conn.querySystem, controlConn.query and controlConn.writeFrame. * Query/Batch.WithRequestTimeout / SetRequestTimeout / GetRequestTimeout: per-request override of ClusterConfig.Timeout, enforced via callReq.timer in Conn.exec independently of the socket deadline. 0 disables the client-side timer. * Conn.finalizeConnection: switches an initialized connection from ConnectTimeout-bound init mode to operational ReadTimeout / WriteTimeout / Metadata.SystemRequestTimeout. Called by hostConnPool.connect, controlConn.connect and controlConn.attemptReconnectToAnyOfHosts. Until then, all socket reads/writes and internal init-phase requests (STARTUP/AUTH/OPTIONS/system.local/USE keyspace) are pinned to ConnectTimeout. Fixes "no connections were made when creating the session" when Timeout is low. * controlConn.HandleError now launches reconnect in a goroutine to avoid a potential deadlock during a connection storm where attemptReconnect holds the controlConn mutex while doing DNS resolution / TCP dial. * connReader.timeout, deadlineContextWriter.timeout and writeCoalescer.timeout are now atomics to allow finalizeConnection to update them concurrently with reader/writer goroutines. * Regression tests: TestNewConnectWithLowTimeout, TestInitSchemaQueryRespectsConnectTimeout, TestControlConnQueryRespectsSystemRequestTimeout, TestQueryRequestTimeout, TestControlConn_HandleError_LaunchesReconnectInGoroutine. * README: new "Connection Timeouts" section documenting the layers and picking guidance. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

