Tejas Lodaya created CASSGO-137:
-----------------------------------
Summary: Honor ConnectTimeout during TLS handshakes
Key: CASSGO-137
URL: https://issues.apache.org/jira/browse/CASSGO-137
Project: Apache Cassandra Go driver
Issue Type: Bug
Reporter: Tejas Lodaya
Assignee: Tejas Lodaya
ConnectTimeout currently bounds TCP dialing but does not bound the subsequent
TLS handshake.
The default host dialer passes its caller's context to WrapTLS, which calls
tls.Conn.HandshakeContext. During bootstrap, that context can have no deadline.
A peer that accepts the TCP connection but never completes the TLS handshake
can therefore block connection setup indefinitely, despite a configured
ConnectTimeout.
Steps to reproduce:
1. Start a TCP listener that accepts connections but does not respond to TLS
handshake messages.
2. Configure the driver to connect to that listener with TLS enabled and a
short ConnectTimeout.
3. Initiate connection setup without a caller deadline.
Actual behavior:
Connection setup can remain blocked beyond ConnectTimeout.
Expected behavior:
ConnectTimeout should bound the combined TCP dialing and TLS handshake
duration. An earlier caller deadline should remain effective.
Proposed change:
Pass ConnectTimeout to the default host dialer and apply one context deadline
across TCP dialing and the TLS handshake. Apply this when a custom Dialer is
configured as well. Custom HostDialer implementations retain responsibility for
their own connection setup.
Regression coverage:
- Stalled TLS handshake times out and closes the underlying connection.
- Earlier caller deadlines are preserved.
- Nonpositive ConnectTimeout values preserve caller context behavior.
- Successful TLS and plain connections remain usable after setup.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]