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
I've been investigating the issue reported in #175 (where a rejected factoryCreate can cause an infinite loop).
I've found that if you call pool.drain() whilst a resource is being acquired the pool will continue to make calls to the factoryCreate function. I believe this is caused by the fact that _dispense doesn't check if the pool has been drained since the initial acquire call was made.
The specific circumstance I'm dealing with is managing a pool of DB connections and if the DB server goes away and you attempt to close the pool, connection attempts still continue to be made.
The text was updated successfully, but these errors were encountered:
Pool.drain is designed to allow any previously made calls to pool.acquire to be given a resource, and for that happen _dispense still needs to be able to potentially create resources etc.
I think this issue is exacerbated by the immediate retry to create a resource on factoryCreateFailure because if there's a problem that means the pool needs to be closed whilst an acquire call is attempting to create a resource, there's no way to exit or abort the acquire calls that will never be able to fulfil.
If I understand correctly, it's intentional that you could never break out of the acquire/_dispense loop in the event that resource creation is no longer possible?
edit: This is highly problematic for managing a pool of DB connections because you'd want to be able to close the pool if the DB server goes away, but that's not possible if the pool is stuck in an acquire loop because connections can't be created
I've been investigating the issue reported in #175 (where a rejected
factoryCreate
can cause an infinite loop).I've found that if you call
pool.drain()
whilst a resource is being acquired the pool will continue to make calls to thefactoryCreate
function. I believe this is caused by the fact that_dispense
doesn't check if the pool has been drained since the initialacquire
call was made.The specific circumstance I'm dealing with is managing a pool of DB connections and if the DB server goes away and you attempt to close the pool, connection attempts still continue to be made.
The text was updated successfully, but these errors were encountered: