Repository navigation
Conversation
_create_ssl_connection() creates TLSUpgradeProto inside
loop.create_connection(). When that call fails or is cancelled after the
protocol exists, the transport is closed and connection_lost(None) sets
ConnectionError('unexpected connection_lost() call') on on_data, which
nothing awaits any more, so asyncio logs "Future exception was never
retrieved". Since 0.32.0 the pool reaches this on its own: Pool.close()
cancels the floor-maintenance connect, and with an unresponsive server
the cancellation can land in that window.
Handle on_data the way __connect_addr() already handles the connected
future: cancel it, or retrieve its exception, when create_connection()
does not return.
|
Reviewed 7d41291 and independently tested its TLS helper against asyncpg 0.32.0 on CPython 3.14.5/macOS. |
Fixes #1397.
_create_ssl_connection()createsTLSUpgradeProtoinsideloop.create_connection(). When that call fails or is cancelled after the protocol exists, the transport is closed andconnection_lost(None)setsConnectionError('unexpected connection_lost() call')onon_data, which nothing awaits any more, so asyncio logs "Future exception was never retrieved". Since 0.32.0Pool.close()cancels the floor-maintenance connect, so closing a pool while the server is unresponsive can log it.on_datais now cancelled, or its exception retrieved, whencreate_connection()does not return, the way__connect_addr()handles theconnectedfuture.test_connection_cancelled_during_transport_setupcoversssl='prefer'as well; it fails on master with the two unretrieved futures and passes with the change.