[ 
https://issues.apache.org/jira/browse/QPID-6672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lorenz Quack updated QPID-6672:
-------------------------------
    Attachment: 
0001-QPID-6672-Java-Client-Message-dispatching-after-disp_v4.patch

Latest version of my patch.
This is build on *_v2 (e.g., it keeps the messageDeliveryLock)

To fix the reported issue I converted the messageDeliveryLock into an explicit 
ReentrantLock. in Dispatcher#dispatchThread() we now tryLock() the 
messageDeliveryLock in a loop while checking whether the session is being 
closed. The rest of the locking semantic are untouched.

This should fix the issue and not introduce new ones. The best of both worlds.

Please review.

> Message dispatching after dispatcher close can cause thread to terminate with 
> IllegalStateException
> ---------------------------------------------------------------------------------------------------
>
>                 Key: QPID-6672
>                 URL: https://issues.apache.org/jira/browse/QPID-6672
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>            Reporter: Keith Wall
>            Priority: Minor
>         Attachments: 
> 0001-QPID-6672-Java-Client-Message-dispatching-after-disp.patch, 
> 0001-QPID-6672-Java-Client-Message-dispatching-after-disp_v2.patch, 
> 0001-QPID-6672-Java-Client-Message-dispatching-after-disp_v3.patch, 
> 0001-QPID-6672-Java-Client-Message-dispatching-after-disp_v4.patch, 
> TEST-org.apache.qpid.test.unit.transacted.TransactionTimeoutTest.testConsumerIdleRollback.txt
>
>
> There is a race between the dispatcher thread and another thread closing a 
> session.  In the unlucky case, the dispatcher thread can die with an ISE as 
> below.
> The issue appears to be that the Dispatcher#close method does not await the 
> shutdown for the dispatcher before returning, so the Dispatcher may run on 
> for another iteration whilst the dispatcher reference has been nulled.
> This appears to be a longstanding issue (the fixme goes back to 2007) and is 
> showing up now owing to r1693225, which makes uncaught exceptions fail the 
> test.
> {noformat}
> 2015-07-29 18:16:37,498         ERROR [Dispatcher-4-Conn-32] 
> o.a.q.t.LoggingUncaughtExceptionHandler Uncaught exception in thread 
> "Dispatcher-4-Conn-32"
> java.lang.IllegalStateException: dispatcher is not started
>       at org.apache.qpid.client.AMQSession.dispatch(AMQSession.java:3267) 
> ~[qpid-client-6.0.0-SNAPSHOT.jar:na]
>       at 
> org.apache.qpid.client.message.UnprocessedMessage.dispatch(UnprocessedMessage.java:54)
>  ~[qpid-client-6.0.0-SNAPSHOT.jar:na]
>       at 
> org.apache.qpid.client.AMQSession$Dispatcher.run(AMQSession.java:3408) 
> ~[qpid-client-6.0.0-SNAPSHOT.jar:na]
>       at java.lang.Thread.run(Thread.java:745) ~[na:1.7.0_67]
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to