File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44Bug Fixes
55---------
66* is_idempotent flag is not propagated from PreparedStatement to BoundStatement (PYTHON-736)
7+ * Fix asyncore hang on exit (PYTHON-767)
78
89Other
910-----
Original file line number Diff line number Diff line change @@ -240,6 +240,8 @@ def add_timer(self, timer):
240240 self ._timers .add_timer (timer )
241241
242242 def _cleanup (self ):
243+ global _dispatcher_map
244+
243245 self ._shutdown = True
244246 if not self ._thread :
245247 return
@@ -253,6 +255,12 @@ def _cleanup(self):
253255
254256 log .debug ("Event loop thread was joined" )
255257
258+ # Ensure all connections are closed and in-flight requests cancelled
259+ for conn in tuple (_dispatcher_map .values ()):
260+ conn .close ()
261+
262+ log .debug ("Dispatchers were closed" )
263+
256264
257265class AsyncoreConnection (Connection , asyncore .dispatcher ):
258266 """
@@ -326,7 +334,7 @@ def close(self):
326334 #This happens when the connection is shutdown while waiting for the ReadyMessage
327335 if not self .connected_event .is_set ():
328336 self .last_error = ConnectionShutdown ("Connection to %s was closed" % self .host )
329-
337+
330338 # don't leave in-progress operations hanging
331339 self .connected_event .set ()
332340
You can’t perform that action at this time.
0 commit comments