File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -3722,11 +3722,14 @@ def _on_timeout(self, _attempts=0):
3722
3722
if self ._connection is not None :
3723
3723
try :
3724
3724
self ._connection ._requests .pop (self ._req_id )
3725
- # This prevents the race condition of the
3726
- # event loop thread just receiving the waited message
3727
- # If it arrives after this, it will be ignored
3725
+ # PYTHON-1044
3726
+ # This request might have been removed from the connection after the latter was defunct by heartbeat.
3727
+ # We should still raise OperationTimedOut to reject the future so that the main event thread will not
3728
+ # wait for it endlessly
3728
3729
except KeyError :
3729
- return
3730
+ key = "Connection defunct by heartbeat"
3731
+ errors = {key : "Client request timeout. See Session.execute[_async](timeout)" }
3732
+ self ._set_final_exception (OperationTimedOut (errors , self ._current_host ))
3730
3733
3731
3734
pool = self .session ._pools .get (self ._current_host )
3732
3735
if pool and not pool .is_shutdown :
You can’t perform that action at this time.
0 commit comments