You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems to me, we increment the count, and then perform an operation to get a connection, which may time out.
It seems the invariant of checkout can be violated, i.e. it increments the count, even though it fails to check out a connection.
This is actually, somewhat suprisingly, handled correctly in with because the timeout interrupt is deferred until within the begin block which has ensure checkout which correctly decrements the count, even in the case of an exception. But during that time, the actual count seems incorrect.
It would appear this makes it tricky/unsafe to use checkout and checkin in general, since the count invariant can be violated.
The text was updated successfully, but these errors were encountered:
connection_pool/lib/connection_pool.rb
Line 122 in 428c06f
It seems to me, we increment the count, and then perform an operation to get a connection, which may time out.
It seems the invariant of
checkout
can be violated, i.e. it increments the count, even though it fails to check out a connection.This is actually, somewhat suprisingly, handled correctly in
with
because the timeout interrupt is deferred until within thebegin
block which hasensure checkout
which correctly decrements the count, even in the case of an exception. But during that time, the actual count seems incorrect.It would appear this makes it tricky/unsafe to use
checkout
andcheckin
in general, since the count invariant can be violated.The text was updated successfully, but these errors were encountered: