[
https://issues.apache.org/jira/browse/POOL-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009866#comment-13009866
]
Mark Thomas commented on POOL-179:
----------------------------------
I think there are three cases we need to handle:
a) latch has been allocated an object
b) latch has been given permission to create an object
c) latch is still in queue
I think there are a couple of issues with the patch above:
- it tries to remove the latch from the queue in cases a) & b) but the latch
will already have been removed (should just be a no-op but still makes sense
not to make the call)
- it doesn't handle case c)
I have a patch in mind based on the patch above but I'd really like a test case
for this but cases a) & b) look like they are going to be tricky to test.
There is also the fact that this code is rather tricky and it has been a while
since I last looked at it. I may be completely wrong in my analysis so an extra
pair of eyes would be good here.
> GenericObjectPool.borrowObject() incorrectly swallos InterruptedException
> -------------------------------------------------------------------------
>
> Key: POOL-179
> URL: https://issues.apache.org/jira/browse/POOL-179
> Project: Commons Pool
> Issue Type: Bug
> Affects Versions: 1.5.5
> Environment: mac osx 10.5.8 jdk 1.6.0_22
> Reporter: Axel Großmann
> Fix For: 1.5.6
>
> Attachments: FileDiff154-155.jpg
>
>
> I just updated from commpons-pool 1.5.4 to 1.5.5 and suddenly some of my
> tests crash with threads hanging.
> After some inspection is appears that GenericObjectPool.borrowObject() no
> longer handles InterruptedException correctly. I made a file diff and found
> that there has been a modification in that area that contains the bug. See
> attached image.
> I have created a patched version absed on 1.5.4 source which works correctly
> in my use case. The important part is:
> {code:java}
> catch (final InterruptedException e)
> {
> synchronized (this)
> {
> if (latch.getPair() == null)
> {
> _allocationQueue.remove(latch);
> }
> else
> {
> _numInternalProcessing--;
> _numActive++;
> _allocationQueue.remove(latch);
> returnObject(latch.getPair().value);
> }
> }
> Thread.currentThread().interrupt();
> throw e;
> }
> {code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira