commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (POOL-179) GenericObjectPool.borrowObject() incorrectly swallows InterruptedException
Date Wed, 23 Mar 2011 00:22:05 GMT

    [ https://issues.apache.org/jira/browse/POOL-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009925#comment-13009925
] 

Phil Steitz commented on POOL-179:
----------------------------------

I agree with you on the three cases, Mark and in a) and b) the latch will have already been
removed.  I think the first part of the patch tries to handle c), but is not quite right now
that I think more about it because the if test will also succeed if the latch has been removed
and mayCreate.  I think the patch tries to do the right thing if the latch has been served.
I will work on a test case and review whatever you come up with.  Seems to me we need to do
the following in your cases
a) return the object to the queue and decrement the internal processing count
b) decrement internal processing count
c) remove the latch from the queue


> GenericObjectPool.borrowObject() incorrectly swallows 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

Mime
View raw message