mperham / connection_pool

Generic connection pooling for Ruby
MIT License
1.63k stars 143 forks source link

Poor behavior when the maximum number of connections have been opened #116

Closed ClearlyClaire closed 5 years ago

ClearlyClaire commented 5 years ago

The @resource condition variable is waited on in a block depending on the same mutex that is used to notify the condition variable.

Unless I'm mistaken, if that condition variable ever gets waited on, this means it'll block every thread for the full timeout, including the threads returning connections to the pool, which could have notified the waiting thread instead.

https://github.com/mperham/connection_pool/blob/master/lib/connection_pool/timed_stack.rb#L87

ClearlyClaire commented 5 years ago

Nevermind, according to Ruby's documentation, this should be fine.