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

Keith Wall commented on QPID-3879:
----------------------------------

There is a race between the Dispatcher thread and the thread calling 
Session#close() (which resets to the reference to the dispatcher within 
#closeConsumers()).

{code:title=AMQSession$Dispatcher.java}
while (!_closed.get() && ((disp = (Dispatchable) _queue.take()) != null))
{
    disp.dispatch(AMQSession.this);
}
{code}


In the above, the LHS of the while expression checks the Dispatcher is not 
closed, then the RHS blocks until a message arrive.  This allows the 
possibility that that the Dispatcher#close() could have been called (and its 
reference nulled) by the time the take() returns. In the unlucky case, a 
message is added to the dispatch queue and AMQSession#close() occurs, causing 
the IllegalStateException further down the delivery path.

The impact on the end-user application is minimal.  As the session is being 
closed, the Broker will ensure that any unack'd messages will be redelivered.   
However, the error message will cause confusion to our users.


                
> Session#close() on session can produce spurious "dispatcher is not started" 
> messages at ERROR to client logs
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-3879
>                 URL: https://issues.apache.org/jira/browse/QPID-3879
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.10, 0.12, 0.14
>            Reporter: Keith Wall
>            Assignee: Keith Wall
>            Priority: Minor
>             Fix For: Future
>
>
> Calling Session#close() on a session which is still in the process of 
> receiving messages can result in the following error message to the client 
> log:
> {code}
> Dispatcher-Channel-1 2012-01-25 22:44:25,298 ERROR 
> [apache.qpid.thread.LoggingUncaughtExceptionHandler] Uncaught exception in 
> thread "Dispatcher-Channel-1"
> java.lang.IllegalStateException: dispatcher is not started
>         at org.apache.qpid.client.AMQSession.dispatch(AMQSession.java:3192)
>         at 
> org.apache.qpid.client.message.UnprocessedMessage.dispatch(UnprocessedMessage.java:55)
>         at 
> org.apache.qpid.client.AMQSession$Dispatcher.run(AMQSession.java:3349)
>         at java.lang.Thread.run(Thread.java:680)
> {code}
> The problem is longstanding issue, but has probably become more noticeable 
> since QPID-1670 which introduced a uncaught exception handle that directs 
> such errors to SLF4J (rather than stderr).   Our tests in general don't show 
> the issue because they tend to consumer all the tests message.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to