You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/10/24 11:00:04 UTC

[jira] [Commented] (POOL-356) deadlock if borrowObject gets called to fast and maxIdle is 0

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

ASF GitHub Bot commented on POOL-356:
-------------------------------------

GitHub user struberg opened a pull request:

    https://github.com/apache/commons-pool/pull/11

    POOL-356 add unit test for the deadlock

    Please review!
    
    Will ship a first fix candidate soon.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/struberg/commons-pool POOL-356

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-pool/pull/11.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #11
    
----
commit 60a041d393c75035e9a63c33723c382ac6f35c30
Author: Mark Struberg <st...@...>
Date:   2018-10-24T10:58:38Z

    POOL-356 add unit test for the deadlock

----


> deadlock if borrowObject gets called to fast and maxIdle is 0
> -------------------------------------------------------------
>
>                 Key: POOL-356
>                 URL: https://issues.apache.org/jira/browse/POOL-356
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 2.6.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Major
>             Fix For: 2.6.1
>
>
> I figured this while creating a unit test for OpenJPA. But also did see this in real production with commons-dbcp2. See DBCP-513 for more info.
> See this comment for a precise explanation what happens https://issues.apache.org/jira/browse/DBCP-513?focusedCommentId=16660545&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16660545
> The problem is basically that the logic to immediately destroy a pool object does not notify the DeLinkedQueue:
> {code}
>         if (isClosed() || maxIdleSave > -1 && maxIdleSave <= idleObjects.size()) {
>             try {
>                 destroy(p);
> {code}
> But the borrowObject code is locking on that condition...
> {code}
>                     if (borrowMaxWaitMillis < 0) {
>                         p = idleObjects.takeFirst();
>                     } 
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)