Skip to content

Commit

Permalink
Fix for case where db_pool connections can be lost.
Browse files Browse the repository at this point in the history
The problem occurs if:
(1) A greenthread was waiting for a connection from the pool
(2) Another thread calls put() to return a connection to the pool,
    but it has expired, so the first thread will be cleared to
    create a new connection
(3) The create() method raises an exception that doesn't inherit
    from Exception, such as eventlet.Timeout

Note that eventlet.pools.Pool.get uses "except:" instead of
"except: Exception" to make sure all exceptions from create() are
accounted for, but eventlet.db_pool.get() incorrectly uses
"except: Exception" in the case where a returned connection was
found to be unusable.
  • Loading branch information
erickj00001 committed Oct 5, 2018
1 parent cf47cb5 commit c3498dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion eventlet/db_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def get(self):
if conn is None:
try:
conn = self.create()
except Exception:
except:
# unconditionally increase the free pool because
# even if there are waiters, doing a full put
# would incur a greenlib switch and thus lose the
Expand Down

0 comments on commit c3498dc

Please sign in to comment.