Issue Details (XML | Word | Printable)

Key: POOL-147
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Giambattista Bloisi
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Pool

Thread stuck in GenericObjectPool borrowObject()

Created: 02/Jul/09 12:10 PM   Updated: 20/Nov/09 09:06 PM
Return to search
Component/s: None
Affects Version/s: 1.5.1
Fix Version/s: 1.5.2

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works 01-borrowObject.patch 2009-07-02 12:11 PM Giambattista Bloisi 2 kB

Resolution Date: 02/Jul/09 12:57 PM


 Description  « Hide
In my application I found a thread stuck at GenericObjectPool.borrowObject(GenericObjectPool.java:1099) even though resources were availbale (in my case connections for DBCP).
After an analysis of the code I think I spotted what could have caused this behavior. GenericObjectPool.java:1099 line corresponds to an indefinite wait to a "latch" object. This wait should be awaken when new resources are made available to the pool. The problem is likely that borrowObject enters in wait without performing "latch.getPair()" check in a critical section.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Giambattista Bloisi added a comment - 02/Jul/09 12:11 PM
Proposed patch

Mark Thomas added a comment - 02/Jul/09 12:57 PM
Many thanks for the report, your analysis and the patch. One day all bug reports will be like this one

I only made one change to your patch which was to break out of the loop as soon as we know we have been allocated an object.

Again, many thanks.