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

Keith Wall commented on QPID-3756:
----------------------------------

Problem is that there is a race condition between the broker, closing the 
connection and unregistering the connection mbean and the test using the mbean 
to observe the number of connections.   When the test fails, the test makes the 
observation too soon.

On the 0-10 path, the broker unregisters the mbean (ServerConnection#closed) 
only after the socket has been closed (IoReceiver.java:175).  This is after the 
broker has sent the ConnectionCloseOk to the client, so the clients #close() 
call will have already returned control to the caller.

On 0-8..0-9-1 the unregister is done much earlier 
(AMQProtocolEngine#closeSession) which is invoked on receipt of 
ConnectionClose, i.e. before the ConnectionCloseOkBody is sent so the same 
problem cannot occur.

We could change 0-10 to unregister the mbean from 
ServerConnectionDelegate.connectionClose() i.e. before the ConnectionCloseOk is 
sent to the client.  Opinions anyone?


{code}
main 2012-01-13 16:15:27,028 DEBUG [apache.qpid.transport.Connection] SEND: 
[conn:78dc9766] ch=0 ConnectionClose(replyCode=NORMAL)
main 2012-01-13 16:15:27,028 DEBUG [apache.qpid.transport.Connection] FLUSH: 
[conn:78dc9766]
BROKER: IoReceiver - /127.0.0.1:41093 2012-01-13 16:15:27,029 DEBUG 
[apache.qpid.transport.Connection] RECV: [conn:53e6978d] ch=0 
ConnectionClose(replyCode=NORMAL)
BROKER: IoReceiver - /127.0.0.1:41093 2012-01-13 16:15:27,029 INFO 
[qpid.message.connection.close] [con:0(clientid@/127.0.0.1:41093/test)] 
[con:0(clientid@/127.0.0.1:41093/test)] CON-1002 : Close
BROKER: IoReceiver - /127.0.0.1:41093 2012-01-13 16:15:27,030 DEBUG 
[apache.qpid.transport.Connection] SEND: [conn:53e6978d] ch=0 
ConnectionCloseOk()
BROKER: IoReceiver - /127.0.0.1:41093 2012-01-13 16:15:27,030 DEBUG 
[apache.qpid.transport.Connection] FLUSH: [conn:53e6978d]
IoReceiver - localhost/127.0.0.1:15672 2012-01-13 16:15:27,030 DEBUG 
[apache.qpid.transport.Connection] RECV: [conn:78dc9766] ch=0 
ConnectionCloseOk()
IoReceiver - localhost/127.0.0.1:15672 2012-01-13 16:15:27,031 DEBUG 
[apache.qpid.transport.Connection] connection closed: conn:78dc9766
XX test close done
XX getting managed connections
BROKER: IoReceiver - /127.0.0.1:41093 2012-01-13 16:15:27,032 DEBUG 
[qpid.server.transport.ServerConnection] unregister mbean
BROKER: IoReceiver - /127.0.0.1:41093 2012-01-13 16:15:27,032 DEBUG 
[apache.qpid.transport.Connection] connection closed: conn:53e6978d
XX test got managed connections
{code}




     
                
> ManagedConnectionMBeanTest.testChannels fails on 0-10 spawned profiles
> ----------------------------------------------------------------------
>
>                 Key: QPID-3756
>                 URL: https://issues.apache.org/jira/browse/QPID-3756
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Tests
>    Affects Versions: 0.15
>            Reporter: Keith Wall
>            Assignee: Keith Wall
>            Priority: Minor
>
> We see the following test fail occasionally on the java-mms-spawn.0-10 and 
> java-bdb-spawn.0-10.  The stack trace is as folows:
> Error Message
> Unexpected number of connection mbeans expected:<0> but was:<1>
> {code}
> Stacktrace
> junit.framework.AssertionFailedError: Unexpected number of connection mbeans 
> expected:<0> but was:<1>
> at 
> org.apache.qpid.management.jmx.ManagedConnectionMBeanTest.testChannels(ManagedConnectionMBeanTest.java:125)
> at 
> org.apache.qpid.test.utils.QpidBrokerTestCase.runBare(QpidBrokerTestCase.java:240)
> at org.apache.qpid.test.utils.QpidTestCase.run(QpidTestCase.java:135)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to