scylladb / python-driver

ScyllaDB Python Driver, originally DataStax Python Driver for Apache Cassandra
https://python-driver.docs.scylladb.com
Apache License 2.0
70 stars 42 forks source link

Close pending connections during shutdown #297

Closed sylwiaszunejko closed 6 months ago

sylwiaszunejko commented 6 months ago

Previously, if the shutdown occurred in the middle of creating a connection to the missing shard in HostConnection, there was no way to close that connection, resulting in the driver hanging for >3 minutes.

This PR introduces a new field in the HostConnection class - _pending_connections - to keep track of connections that are in the middle of being created, along with a mechanism to close these connections if shutdown was executed.

Fixes: #262 (this reproducer - https://github.com/kbr-scylla/scylladb/commits/test-pause - doesn’t reproduce with that fix)

sylwiaszunejko commented 6 months ago

@avelanarius The comment and the commit message fixed