Multiple threads trying to acquire a connection leads to hang

Bug #1248698 reported by Larry Streepy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
BoneCP
New
Undecided
Unassigned

Bug Description

When multiple threads all try to acquire a connection at the same time from a single partition, even if there is room in the pool to create that many connections, only some will actually get a connection. The others will be blocked until some other event (like a connection close) either releases the poll() on the free queue or wakes up the pool watch thread.

I've attached a sample program that easily demonstrates this problem. The accompanying pom.xml can be used to build it.

Near the top of the sample program, there is a constant "FAIL" set to true. If run as is, the program will hang indefinitely. If you change it to false, things work. The factors in this bug are whether the connection consumers close their connection at some point. If they don't, then things will hang, UNLESS the poolAvailabilityThreshold is set to something other than 0.

With threshold at 0 and no closing - you get a hang.

Why doesn't the pool actually track the number of outstanding connection requests and create that many connections (as long as maxConnections is not exceeded)?

This appears to be a bug to me, or at the least an extremely obscure configuration requirement (the use of a non-zero availability threshold in order to avoid the hang).

Revision history for this message
Larry Streepy (lstreepy) wrote :
Revision history for this message
Larry Streepy (lstreepy) wrote :

maven pom file for building

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.