You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Martin Ritchie (JIRA)" <qp...@incubator.apache.org> on 2007/01/23 10:19:49 UTC

[jira] Created: (QPID-313) [Race Condition] Call to attainState in makeBrokerConnection can miss the notification of state change.

[Race Condition] Call to attainState in makeBrokerConnection can miss the notification of state change.
-------------------------------------------------------------------------------------------------------

                 Key: QPID-313
                 URL: https://issues.apache.org/jira/browse/QPID-313
             Project: Qpid
          Issue Type: Bug
          Components: Java Client
            Reporter: Martin Ritchie
            Priority: Blocker


in AMQConnection()
            TransportConnection.getInstance(brokerDetail).connect(_protocolHandler, brokerDetail);
            // this blocks until the connection has been set up or when an error
            // has prevented the connection being set up
            _protocolHandler.attainState(AMQState.CONNECTION_OPEN);
            _failoverPolicy.attainedConnection();

This is the only use of attainState in the code. Problem is that the connect can occur and proceed without locking on the state to attain.

Possible issue in AMQStateManager... attainState() [again only call to this is the above code]

The _currentState is checked inside synchronized (_stateListener) block. However _currentState is modifed in the changeState method OUTSIDE of the synchronized (_stateListener)  block. Doing the change in side the block should ensure that the attainState waiter is setup correctly.

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


[jira] Resolved: (QPID-313) [Race Condition] Call to attainState in makeBrokerConnection can miss the notification of state change.

Posted by "Robert Greig (JIRA)" <qp...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Greig resolved QPID-313.
-------------------------------

       Resolution: Fixed
    Fix Version/s: M2

Patch applied svn revision 501011

> [Race Condition] Call to attainState in makeBrokerConnection can miss the notification of state change.
> -------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-313
>                 URL: https://issues.apache.org/jira/browse/QPID-313
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>            Reporter: Martin Ritchie
>            Priority: Blocker
>             Fix For: M2
>
>         Attachments: QPID-313.patch
>
>
> in AMQConnection()
>             TransportConnection.getInstance(brokerDetail).connect(_protocolHandler, brokerDetail);
>             // this blocks until the connection has been set up or when an error
>             // has prevented the connection being set up
>             _protocolHandler.attainState(AMQState.CONNECTION_OPEN);
>             _failoverPolicy.attainedConnection();
> This is the only use of attainState in the code. Problem is that the connect can occur and proceed without locking on the state to attain.
> Possible issue in AMQStateManager... attainState() [again only call to this is the above code]
> The _currentState is checked inside synchronized (_stateListener) block. However _currentState is modifed in the changeState method OUTSIDE of the synchronized (_stateListener)  block. Doing the change in side the block should ensure that the attainState waiter is setup correctly.

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


[jira] Updated: (QPID-313) [Race Condition] Call to attainState in makeBrokerConnection can miss the notification of state change.

Posted by "Rob Godfrey (JIRA)" <qp...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Godfrey updated QPID-313:
-----------------------------

    Attachment: QPID-313.patch

> [Race Condition] Call to attainState in makeBrokerConnection can miss the notification of state change.
> -------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-313
>                 URL: https://issues.apache.org/jira/browse/QPID-313
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>            Reporter: Martin Ritchie
>            Priority: Blocker
>         Attachments: QPID-313.patch
>
>
> in AMQConnection()
>             TransportConnection.getInstance(brokerDetail).connect(_protocolHandler, brokerDetail);
>             // this blocks until the connection has been set up or when an error
>             // has prevented the connection being set up
>             _protocolHandler.attainState(AMQState.CONNECTION_OPEN);
>             _failoverPolicy.attainedConnection();
> This is the only use of attainState in the code. Problem is that the connect can occur and proceed without locking on the state to attain.
> Possible issue in AMQStateManager... attainState() [again only call to this is the above code]
> The _currentState is checked inside synchronized (_stateListener) block. However _currentState is modifed in the changeState method OUTSIDE of the synchronized (_stateListener)  block. Doing the change in side the block should ensure that the attainState waiter is setup correctly.

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


[jira] Commented: (QPID-313) [Race Condition] Call to attainState in makeBrokerConnection can miss the notification of state change.

Posted by "Rob Godfrey (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12468219 ] 

Rob Godfrey commented on QPID-313:
----------------------------------

Rather than use state listeners, it is easier to simply lock on an object and wait until a notifyAll is called when the state is changed.  this also allows more easily for timeouts.  

Patch to follow.

> [Race Condition] Call to attainState in makeBrokerConnection can miss the notification of state change.
> -------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-313
>                 URL: https://issues.apache.org/jira/browse/QPID-313
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>            Reporter: Martin Ritchie
>            Priority: Blocker
>
> in AMQConnection()
>             TransportConnection.getInstance(brokerDetail).connect(_protocolHandler, brokerDetail);
>             // this blocks until the connection has been set up or when an error
>             // has prevented the connection being set up
>             _protocolHandler.attainState(AMQState.CONNECTION_OPEN);
>             _failoverPolicy.attainedConnection();
> This is the only use of attainState in the code. Problem is that the connect can occur and proceed without locking on the state to attain.
> Possible issue in AMQStateManager... attainState() [again only call to this is the above code]
> The _currentState is checked inside synchronized (_stateListener) block. However _currentState is modifed in the changeState method OUTSIDE of the synchronized (_stateListener)  block. Doing the change in side the block should ensure that the attainState waiter is setup correctly.

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