activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jayson Minard (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (AMQ-1971) ConcurrentModificationException in high volume broker
Date Mon, 13 Oct 2008 06:58:52 GMT

    [ https://issues.apache.org/activemq/browse/AMQ-1971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46388#action_46388
] 

jayson.minard edited comment on AMQ-1971 at 10/12/08 11:58 PM:
---------------------------------------------------------------

I have a tested patch for the ConcurrentModificationException in AMQ-1971, this also uncovered
a bug with a related class.  See below:

Patch to fix ConcurrentModificationException which is caused by not having a perfectly synchronized
this.iterator and this.batchList in AbstractStoreCursor.  Also removed any access to these
member variables from subclasses to ensure they are synchronized and make sure they are not
manipulated seperately.  This caused a small change in TopicStorePrefetch which had a reference
to batchList although it actually overrode the ancestor class which meant that its remove()
method never actually worked.  So that was replaced with a call to AbstractSoreCursor to do
the actual remove work.  A few TODO comments are left in the patch for review by someone that
knows more.

Basically, the fix is to ensure that all changes to batchList cause a release of the cached
iterator.

I apologize in advance for reformatting the code before generating the patch.  I did that
midway through the edit and it is a constant habit so it caused some noise in the patch. 
If you apply it, then diff while ignoring white-space most of the noise is removed.

      was (Author: jayson.minard):
    I have a tested patch for the ConcurrentModificationException in AMQ-1971, this also uncovered
a bug with a related class.  See below:

Patch to fix ConcurrentModificationException which is caused by not having a perfectly synchronized
this.iterator and this.batchList in AbstractStoreCursor.  Also removed any access to these
member variables from subclasses to ensure they are synchronized and make sure they are not
manipulated seperately.  This caused a small change in TopicStorePrefetch which had a reference
to batchList although it actually overrode the ancestor class which meant that its remove()
method never actually worked.  So that was replaced with a call to AbstractSoreCursor to do
the actual remove work.  A few TODO comments are left in the patch for review by someone that
knows more.

Basically, the fix is to ensure that all changes to batchList cause a release of the cached
iterator.
  
> ConcurrentModificationException in high volume broker 
> ------------------------------------------------------
>
>                 Key: AMQ-1971
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1971
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.2.0
>            Reporter: Jayson Minard
>            Assignee: Rob Davies
>         Attachments: amq1971.patch
>
>
> This is occurring in the thousands as messages come through.    We have a network of
5 brokers although they do most of their work internally (publisher/consumer for queue are
only on same broker) and do less work crossing to a central broker.
> java.util.ConcurrentModificationException
> 	at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:373)
> 	at java.util.LinkedHashMap$EntryIterator.next(LinkedHashMap.java:392)
> 	at java.util.LinkedHashMap$EntryIterator.next(LinkedHashMap.java:391)
> 	at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.next(AbstractStoreCursor.java:136)
> 	at org.apache.activemq.broker.region.cursors.StoreQueueCursor.next(StoreQueueCursor.java:140)
> 	at org.apache.activemq.broker.region.Queue.doPageIn(Queue.java:1178)
> 	at org.apache.activemq.broker.region.Queue.pageInMessages(Queue.java:1290)
> 	at org.apache.activemq.broker.region.Queue.iterate(Queue.java:1004)
> 	at org.apache.activemq.thread.DeterministicTaskRunner.runTask(DeterministicTaskRunner.java:84)
> 	at org.apache.activemq.thread.DeterministicTaskRunner$1.run(DeterministicTaskRunner.java:41)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:619)

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


Mime
View raw message