I am using ActiveMq-4.0-RC3. I have been having intermittent problems getting sessions created and closed. I have downloaded the code and traced through it and I think I have found the problem.
There is a race conditon in the TcpTransport class, in the doStart() method. As near as I can tell, as soon as the socket is created, the Broker responds with its WireFormatInfo. This information is usually stored as the remoteWireFormatInfo in the InactivityMonitor. The race condition occurs in the doStart() method as it appears the broker can sometimes send the wireFormatInfo before the initializeStreams() method can be called. This results in the information not being capture in the dataIn input buffer. Once this occurs, this sets up the session hangs that I have been experiencing. Since the remoteWireFormatInfo was never captured from the broker, requests to InactivityMonitor.startMonitorThreads() does not start as the condition of having a remoteWireFormatInfo is not met and the method just returns. That causes not socket activities at all. The original thread eventually proceeds to the WireFormatNegotiator.oneway(command) method that issues a readyCountDownLatch.await(); which is never met and never times out. I have written a thread to call the create session function and give it a maximum of 15 seconds to complete. If the thread exceeds that time, it is sent an interrupt, but that does not seem to interrupt the readyCountDownLatch.await(). Eventually I get all these hung threads that I cannot clean up. I would liike to see if the race conditon can be fixed, but in addition why I cannot issue an interrupt against this thread when it gets into this state. -- View this message in context: http://www.nabble.com/Race-Condition--t1522683.html#a4135015 Sent from the ActiveMQ - User forum at Nabble.com.
