Commit 9def8518 authored by Philippe Pepiot's avatar Philippe Pepiot
Browse files

[server] avoid a possible race condition on _CnxSetPool.close()

The pool could become empty between time to check and time to use.
parent b10688370322
......@@ -206,9 +206,11 @@ class _CnxSetPool(_BaseCnxSet):
yield cnxset
def close(self):
while not self._queue.empty():
cnxset = self._queue.get_nowait()
while True:
try:
cnxset = self._queue.get_nowait()
except queue.Empty:
break
try:
cnxset.close(True)
except Exception as e:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment