qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rajith Attapattu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (QPID-4574) [JMS] Deadlock involving _failoverMutex and _messageDeliveryLock
Date Fri, 08 Feb 2013 16:47:13 GMT

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

Rajith Attapattu commented on QPID-4574:
----------------------------------------

{code}
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
index 91a6389..8a7d807 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
@@ -3265,44 +3265,45 @@ public abstract class AMQSession<C extends BasicMessageConsumer,
P extends Basic
         {
             long deliveryTag = message.getDeliveryTag();
 
-            synchronized (_lock)
+            synchronized (_connection.getFailoverMutex())
             {
-
-                try
+                synchronized (_lock)
                 {
-                    while (connectionStopped())
+                    try
                     {
-                        _lock.wait();
+                        while (connectionStopped())
+                        {
+                            _lock.wait();
+                        }
+                    }
+                    catch (InterruptedException e)
+                    {
+                        Thread.currentThread().interrupt();
                     }
-                }
-                catch (InterruptedException e)
-                {
-                    Thread.currentThread().interrupt();
-                }
 
-                if (!(message instanceof CloseConsumerMessage)
-                    && tagLE(deliveryTag, _rollbackMark.get()))
-                {
-                    if (_logger.isDebugEnabled())
+                    if (!(message instanceof CloseConsumerMessage)
+                        && tagLE(deliveryTag, _rollbackMark.get()))
                     {
-                        _logger.debug("Rejecting message because delivery tag " + deliveryTag
-                                + " <= rollback mark " + _rollbackMark.get());
+                        if (_logger.isDebugEnabled())
+                        {
+                            _logger.debug("Rejecting message because delivery tag " + deliveryTag
+                                    + " <= rollback mark " + _rollbackMark.get());
+                        }
+                        rejectMessage(message, true);
                     }
-                    rejectMessage(message, true);
-                }
-                else if (_usingDispatcherForCleanup)
-                {
-                    _prefetchedMessageTags.add(deliveryTag);
-                }
-                else
-                {
-                    synchronized (_messageDeliveryLock)
+                    else if (_usingDispatcherForCleanup)
+                    {
+                        _prefetchedMessageTags.add(deliveryTag);
+                    }
+                    else
                     {
-                        notifyConsumer(message);
+                        synchronized (_messageDeliveryLock)
+                        {
+                            notifyConsumer(message);
+                        }
                     }
                 }
             }
-
             long current = _rollbackMark.get();
             if (updateRollbackMark(current, deliveryTag))
             {
{code}
                
> [JMS] Deadlock involving _failoverMutex and _messageDeliveryLock
> ----------------------------------------------------------------
>
>                 Key: QPID-4574
>                 URL: https://issues.apache.org/jira/browse/QPID-4574
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.14, 0.16, 0.18, 0.20
>            Reporter: Rajith Attapattu
>            Assignee: Rajith Attapattu
>              Labels: deadlock
>             Fix For: 0.21
>
>         Attachments: Test_00782235.java
>
>
> This deadlock can manifest when a you have a producer sending messages inside an onMessage()
call.
> This is a common enough pattern, and is used by intermediaries like Message Bridges,
ESB's etc..
> "Dispatcher-0-Conn-1":
> 	at org.apache.qpid.client.BasicMessageProducer.send(BasicMessageProducer.java:309)
> 	- waiting to lock <0x00000000ecfd15a8> (a java.lang.Object)
> 	at Test_00782235$1.onMessage(Test_00782235.java:29)
> 	at org.apache.qpid.client.BasicMessageConsumer.notifyMessage(BasicMessageConsumer.java:751)
> 	at org.apache.qpid.client.BasicMessageConsumer_0_10.notifyMessage(BasicMessageConsumer_0_10.java:141)
> 	at org.apache.qpid.client.BasicMessageConsumer.notifyMessage(BasicMessageConsumer.java:725)
> 	at org.apache.qpid.client.BasicMessageConsumer_0_10.notifyMessage(BasicMessageConsumer_0_10.java:186)
> 	at org.apache.qpid.client.BasicMessageConsumer_0_10.notifyMessage(BasicMessageConsumer_0_10.java:54)
> 	at org.apache.qpid.client.AMQSession$Dispatcher.notifyConsumer(AMQSession.java:3479)
> 	at org.apache.qpid.client.AMQSession$Dispatcher.dispatchMessage(AMQSession.java:3418)
> 	- locked <0x00000000ecfd16c8> (a java.lang.Object)
> 	- locked <0x00000000ecfd16d8> (a java.lang.Object)
> 	at org.apache.qpid.client.AMQSession$Dispatcher.access$1000(AMQSession.java:3205)
> 	at org.apache.qpid.client.AMQSession.dispatch(AMQSession.java:3198)
> 	at org.apache.qpid.client.message.UnprocessedMessage.dispatch(UnprocessedMessage.java:54)
> 	at org.apache.qpid.client.AMQSession$Dispatcher.run(AMQSession.java:3341)
> 	at java.lang.Thread.run(Thread.java:679)
> "main":
> 	at org.apache.qpid.client.BasicMessageConsumer.close(BasicMessageConsumer.java:598)
> 	- waiting to lock <0x00000000ecfd16c8> (a java.lang.Object)
> 	- locked <0x00000000ecfd15a8> (a java.lang.Object)
> 	at org.apache.qpid.client.BasicMessageConsumer.close(BasicMessageConsumer.java:558)
> 	at Test_00782235.<init>(Test_00782235.java:62)
> 	at Test_00782235.main(Test_00782235.java:12)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


Mime
View raw message