[jira] Created: (POOL-162) When waiting threads are interrupted, pool can leak capacity

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (POOL-162) When waiting threads are interrupted, pool can leak capacity

Gilles Sadowski (Jira)
When waiting threads are interrupted, pool can leak capacity
------------------------------------------------------------

                 Key: POOL-162
                 URL: https://issues.apache.org/jira/browse/POOL-162
             Project: Commons Pool
          Issue Type: Bug
    Affects Versions: 1.5.4, 1.5.3, 1.5.2, 1.5.1, 1.5
            Reporter: Phil Steitz


As reported on commons-dev (http://markmail.org/message/aqb23nnzyy2ar3vs), when waiting threads are interrupted, GOP, GKOP may leak capacity.   I do not yet have a test case to confirm this, but I suspect that the problem reported by the user is caused by a missing  _allocationQueue.remove(latch) before rethrowing InterruptedException in borrowObject.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (POOL-162) When waiting threads are interrupted, pool can leak capacity

Gilles Sadowski (Jira)

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

Mark Thomas commented on POOL-162:
----------------------------------

This should be fixed but I'd appreciate another pair of eyes on this before marking it as resolved.

> When waiting threads are interrupted, pool can leak capacity
> ------------------------------------------------------------
>
>                 Key: POOL-162
>                 URL: https://issues.apache.org/jira/browse/POOL-162
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4
>            Reporter: Phil Steitz
>
> As reported on commons-dev (http://markmail.org/message/aqb23nnzyy2ar3vs), when waiting threads are interrupted, GOP, GKOP may leak capacity.   I do not yet have a test case to confirm this, but I suspect that the problem reported by the user is caused by a missing  _allocationQueue.remove(latch) before rethrowing InterruptedException in borrowObject.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (POOL-162) When waiting threads are interrupted, pool can leak capacity

Gilles Sadowski (Jira)
In reply to this post by Gilles Sadowski (Jira)

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

Phil Steitz commented on POOL-162:
----------------------------------

Thanks, Mark!

Gave me a headache, but the test and fix look good, modulo one comment. With your patch, if the latch has been served when the thread is interrupted, we do not propagate the interrupt, but let the thread continue and get served. This seems reasonable for most use cases. The alternative would be to handle mayCreate and pair != null separately, in the second case destroying the object and in both cases removing the latch from the queue and setting thread interrupt status. If the interrupt is to shorten or end the wait, the patch impl is probably best. If for another reason, the client might rather propagate the exception and not use pool capacity. I can't t think of realistic use cases where the second would be the case, so unless someone else can, I am +1 on resolving this based on the fix in r924479

> When waiting threads are interrupted, pool can leak capacity
> ------------------------------------------------------------
>
>                 Key: POOL-162
>                 URL: https://issues.apache.org/jira/browse/POOL-162
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4
>            Reporter: Phil Steitz
>
> As reported on commons-dev (http://markmail.org/message/aqb23nnzyy2ar3vs), when waiting threads are interrupted, GOP, GKOP may leak capacity.   I do not yet have a test case to confirm this, but I suspect that the problem reported by the user is caused by a missing  _allocationQueue.remove(latch) before rethrowing InterruptedException in borrowObject.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (POOL-162) When waiting threads are interrupted, pool can leak capacity

Gilles Sadowski (Jira)
In reply to this post by Gilles Sadowski (Jira)

     [ https://issues.apache.org/jira/browse/POOL-162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Thomas resolved POOL-162.
------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5.5

Thanks for the review Phil. That concurs with my view.

> When waiting threads are interrupted, pool can leak capacity
> ------------------------------------------------------------
>
>                 Key: POOL-162
>                 URL: https://issues.apache.org/jira/browse/POOL-162
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4
>            Reporter: Phil Steitz
>             Fix For: 1.5.5
>
>
> As reported on commons-dev (http://markmail.org/message/aqb23nnzyy2ar3vs), when waiting threads are interrupted, GOP, GKOP may leak capacity.   I do not yet have a test case to confirm this, but I suspect that the problem reported by the user is caused by a missing  _allocationQueue.remove(latch) before rethrowing InterruptedException in borrowObject.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.