You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Andrei N.Sobchuck (JIRA)" <ji...@apache.org> on 2013/04/08 09:31:16 UTC

[jira] [Updated] (AMQ-4441) Race condition in PooledConnectionFactory.createConnection

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

Andrei N.Sobchuck updated AMQ-4441:
-----------------------------------

    Attachment: AMQ_4441.java

Try attached AMQ_4441. It's not stable (due to nature of the issue) and it can take long time to crash.
                
> Race condition in PooledConnectionFactory.createConnection
> ----------------------------------------------------------
>
>                 Key: AMQ-4441
>                 URL: https://issues.apache.org/jira/browse/AMQ-4441
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: activemq-pool
>    Affects Versions: 5.8.0
>            Reporter: Andrei N.Sobchuck
>         Attachments: AMQ_4441.java
>
>
> `PooledConnectionFactory.createConnection(String userName, String password)` can return broken Connection. By `broken` I mean PooledConnection with referenceCount==1, but without underlying ActiveMQConnection.
> The problem is in lines 
> {code}
> connection = connectionsPool.borrowObject(key);
> ...
> return new PooledConnection(connection);
> {code}
> While method `borrowObject` validates the connection and `new PooledConnection` increments referenceCount, it's possible that some thread calls `ConnectionPool.decrementReferenceCount()` just between `borrowObject` and `new PooledConnection`. referenceCount at this stage can be a zero and the ConnectionPool became closed just prior to `new PooledConnection`.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira