You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Matthew Roy (JIRA)" <ji...@apache.org> on 2008/03/21 20:08:35 UTC

[jira] Created: (AMQ-1631) Concurrency Issue in MessageConsumer's deliveredMessages within dispose

Concurrency Issue in MessageConsumer's deliveredMessages within dispose
-----------------------------------------------------------------------

                 Key: AMQ-1631
                 URL: https://issues.apache.org/activemq/browse/AMQ-1631
             Project: ActiveMQ
          Issue Type: Bug
    Affects Versions: 5.0.0
            Reporter: Matthew Roy
            Assignee: Rob Davies
             Fix For: 5.1.0


The LinkedList can be modified concurrently - see http://www.nabble.com/NPE-while-consuming-messages-to12301153s2354.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (AMQ-1631) Concurrency Issue in MessageConsumer's deliveredMessages within dispose

Posted by "Rob Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Davies resolved AMQ-1631.
-----------------------------

    Resolution: Fixed

Patch applied in svn revision 646248

> Concurrency Issue in MessageConsumer's deliveredMessages within dispose
> -----------------------------------------------------------------------
>
>                 Key: AMQ-1631
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1631
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.0.0
>            Reporter: Matthew Roy
>            Assignee: Rob Davies
>             Fix For: 5.1.0
>
>         Attachments: activemq.patch
>
>
> The LinkedList can be modified concurrently - see http://www.nabble.com/NPE-while-consuming-messages-to12301153s2354.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (AMQ-1631) Concurrency Issue in MessageConsumer's deliveredMessages within dispose

Posted by "Matthew Roy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-1631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=41755#action_41755 ] 

mooseroy edited comment on AMQ-1631 at 3/21/08 12:09 PM:
------------------------------------------------------------

I see frequent concurrency errors due to the dispose method not synchronizing on the deliveredMessages linkedList.  Here is a patch that I think addresses the issue:

Attaching patch file

      was (Author: mooseroy):
    I see frequent concurrency errors due to the dispose method not synchronizing on the deliveredMessages linkedList.  Here is a patch that I think addresses the issue:

Index: /work/src/activemq/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java
===================================================================
--- /work/src/activemq/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java	(revision 639741)
+++ /work/src/activemq/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java	(working copy)
@@ -659,8 +659,10 @@
                         session.connection.rollbackDuplicate(this, old.getMessage());
                     }
                 }
+            } 
+            synchronized(deliveredMessages) {
+                deliveredMessages.clear();
             }
-            deliveredMessages.clear();
             List<MessageDispatch> list = unconsumedMessages.removeAll();
             if (!this.info.isBrowser()) {
                 for (MessageDispatch old : list) {

  
> Concurrency Issue in MessageConsumer's deliveredMessages within dispose
> -----------------------------------------------------------------------
>
>                 Key: AMQ-1631
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1631
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.0.0
>            Reporter: Matthew Roy
>            Assignee: Rob Davies
>             Fix For: 5.1.0
>
>         Attachments: activemq.patch
>
>
> The LinkedList can be modified concurrently - see http://www.nabble.com/NPE-while-consuming-messages-to12301153s2354.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQ-1631) Concurrency Issue in MessageConsumer's deliveredMessages within dispose

Posted by "Matthew Roy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-1631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=41755#action_41755 ] 

Matthew Roy commented on AMQ-1631:
----------------------------------

I see frequent concurrency errors due to the dispose method not synchronizing on the deliveredMessages linkedList.  Here is a patch that I think addresses the issue:

Index: /work/src/activemq/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java
===================================================================
--- /work/src/activemq/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java	(revision 639741)
+++ /work/src/activemq/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java	(working copy)
@@ -659,8 +659,10 @@
                         session.connection.rollbackDuplicate(this, old.getMessage());
                     }
                 }
+            } 
+            synchronized(deliveredMessages) {
+                deliveredMessages.clear();
             }
-            deliveredMessages.clear();
             List<MessageDispatch> list = unconsumedMessages.removeAll();
             if (!this.info.isBrowser()) {
                 for (MessageDispatch old : list) {


> Concurrency Issue in MessageConsumer's deliveredMessages within dispose
> -----------------------------------------------------------------------
>
>                 Key: AMQ-1631
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1631
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.0.0
>            Reporter: Matthew Roy
>            Assignee: Rob Davies
>             Fix For: 5.1.0
>
>
> The LinkedList can be modified concurrently - see http://www.nabble.com/NPE-while-consuming-messages-to12301153s2354.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AMQ-1631) Concurrency Issue in MessageConsumer's deliveredMessages within dispose

Posted by "Matthew Roy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthew Roy updated AMQ-1631:
-----------------------------

    Attachment: activemq.patch

Patch to synchronize on deliveredMessages

> Concurrency Issue in MessageConsumer's deliveredMessages within dispose
> -----------------------------------------------------------------------
>
>                 Key: AMQ-1631
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1631
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.0.0
>            Reporter: Matthew Roy
>            Assignee: Rob Davies
>             Fix For: 5.1.0
>
>         Attachments: activemq.patch
>
>
> The LinkedList can be modified concurrently - see http://www.nabble.com/NPE-while-consuming-messages-to12301153s2354.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.