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

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

    [ 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.