You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Gary Tully (JIRA)" <ji...@apache.org> on 2008/05/14 15:03:43 UTC

[jira] Created: (AMQ-1727) java.lang.IllegalStateException: Timer already cancelled caused by Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException and

java.lang.IllegalStateException: Timer already cancelled caused by Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException and 
----------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: AMQ-1727
                 URL: https://issues.apache.org/activemq/browse/AMQ-1727
             Project: ActiveMQ
          Issue Type: Bug
          Components: Message Store
    Affects Versions: 5.1.0
            Reporter: Gary Tully


stack trace causes timer thread to abort:

Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
at java.util.HashMap$KeyIterator.next(HashMap.java:877)
at java.util.AbstractSet.removeAll(AbstractSet.java:143)
at org.apache.activemq.kaha.impl.async.AsyncDataManager.consolidateDataFilesNotIn(AsyncDataManager.java:404)
at org.apache.activemq.store.amq.AMQPersistenceAdapter.cleanup(AMQPersistenceAdapter.java:415)
at org.apache.activemq.store.amq.AMQPersistenceAdapter$3.run(AMQPersistenceAdapter.java:267)
at org.apache.activemq.thread.SchedulerTimerTask.run(SchedulerTimerTask.java:33)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)

subsequent timer enqueue fails with:

java.lang.IllegalStateException: Timer already cancelled.
at java.util.Timer.sched(Timer.java:354)
at java.util.Timer.scheduleAtFixedRate(Timer.java:296)
at org.apache.activemq.thread.Scheduler.executePeriodically(Scheduler.java:38)
at org.apache.activemq.kaha.impl.async.AsyncDataManager.start(AsyncDataManager.java:190)
at org.apache.activemq.store.amq.AMQPersistenceAdapter.start(AMQPersistenceAdapter.java:207)
at org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1597)
at org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:1550)
at org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:560)
at org.apache.activemq.broker.BrokerService.start(BrokerService.java:455)

Problem identified in this diff, the inUse set needs to be copied as it may be modified in parallel to the cleanup.

Index: activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
===================================================================
--- activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java        (revision 655936)
+++ activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java        (working copy)
@@ -411,7 +411,7 @@
             }
             Integer lastDataFile = asyncDataManager.getCurrentDataFileId();
             inProgress.add(lastDataFile);
-            Set<Integer> inUse = referenceStoreAdapter.getReferenceFileIdsInUse();
+            Set<Integer> inUse = new HashSet<Integer>(referenceStoreAdapter.getReferenceFileIdsInUse());
             asyncDataManager.consolidateDataFilesNotIn(inUse, inProgress);
         } catch (IOException e) {
             LOG.error("Could not cleanup data files: " + e, e);

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


[jira] Closed: (AMQ-1727) java.lang.IllegalStateException: Timer already cancelled caused by Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException and

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

Gary Tully closed AMQ-1727.
---------------------------


> java.lang.IllegalStateException: Timer already cancelled caused by Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException and 
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-1727
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1727
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Message Store
>    Affects Versions: 5.1.0
>            Reporter: Gary Tully
>            Assignee: Rob Davies
>             Fix For: 5.2.0
>
>         Attachments: AMQ-1727.patch
>
>
> stack trace causes timer thread to abort:
> Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException
> at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
> at java.util.HashMap$KeyIterator.next(HashMap.java:877)
> at java.util.AbstractSet.removeAll(AbstractSet.java:143)
> at org.apache.activemq.kaha.impl.async.AsyncDataManager.consolidateDataFilesNotIn(AsyncDataManager.java:404)
> at org.apache.activemq.store.amq.AMQPersistenceAdapter.cleanup(AMQPersistenceAdapter.java:415)
> at org.apache.activemq.store.amq.AMQPersistenceAdapter$3.run(AMQPersistenceAdapter.java:267)
> at org.apache.activemq.thread.SchedulerTimerTask.run(SchedulerTimerTask.java:33)
> at java.util.TimerThread.mainLoop(Timer.java:512)
> at java.util.TimerThread.run(Timer.java:462)
> subsequent timer enqueue fails with:
> java.lang.IllegalStateException: Timer already cancelled.
> at java.util.Timer.sched(Timer.java:354)
> at java.util.Timer.scheduleAtFixedRate(Timer.java:296)
> at org.apache.activemq.thread.Scheduler.executePeriodically(Scheduler.java:38)
> at org.apache.activemq.kaha.impl.async.AsyncDataManager.start(AsyncDataManager.java:190)
> at org.apache.activemq.store.amq.AMQPersistenceAdapter.start(AMQPersistenceAdapter.java:207)
> at org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1597)
> at org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:1550)
> at org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:560)
> at org.apache.activemq.broker.BrokerService.start(BrokerService.java:455)
> Problem identified in this diff, the inUse set needs to be copied as it may be modified in parallel to the cleanup.
> Index: activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
> ===================================================================
> --- activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java        (revision 655936)
> +++ activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java        (working copy)
> @@ -411,7 +411,7 @@
>              }
>              Integer lastDataFile = asyncDataManager.getCurrentDataFileId();
>              inProgress.add(lastDataFile);
> -            Set<Integer> inUse = referenceStoreAdapter.getReferenceFileIdsInUse();
> +            Set<Integer> inUse = new HashSet<Integer>(referenceStoreAdapter.getReferenceFileIdsInUse());
>              asyncDataManager.consolidateDataFilesNotIn(inUse, inProgress);
>          } catch (IOException e) {
>              LOG.error("Could not cleanup data files: " + e, e);

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


[jira] Assigned: (AMQ-1727) java.lang.IllegalStateException: Timer already cancelled caused by Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException and

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

Rob Davies reassigned AMQ-1727:
-------------------------------

    Assignee: Rob Davies

> java.lang.IllegalStateException: Timer already cancelled caused by Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException and 
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-1727
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1727
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Message Store
>    Affects Versions: 5.1.0
>            Reporter: Gary Tully
>            Assignee: Rob Davies
>         Attachments: AMQ-1727.patch
>
>
> stack trace causes timer thread to abort:
> Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException
> at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
> at java.util.HashMap$KeyIterator.next(HashMap.java:877)
> at java.util.AbstractSet.removeAll(AbstractSet.java:143)
> at org.apache.activemq.kaha.impl.async.AsyncDataManager.consolidateDataFilesNotIn(AsyncDataManager.java:404)
> at org.apache.activemq.store.amq.AMQPersistenceAdapter.cleanup(AMQPersistenceAdapter.java:415)
> at org.apache.activemq.store.amq.AMQPersistenceAdapter$3.run(AMQPersistenceAdapter.java:267)
> at org.apache.activemq.thread.SchedulerTimerTask.run(SchedulerTimerTask.java:33)
> at java.util.TimerThread.mainLoop(Timer.java:512)
> at java.util.TimerThread.run(Timer.java:462)
> subsequent timer enqueue fails with:
> java.lang.IllegalStateException: Timer already cancelled.
> at java.util.Timer.sched(Timer.java:354)
> at java.util.Timer.scheduleAtFixedRate(Timer.java:296)
> at org.apache.activemq.thread.Scheduler.executePeriodically(Scheduler.java:38)
> at org.apache.activemq.kaha.impl.async.AsyncDataManager.start(AsyncDataManager.java:190)
> at org.apache.activemq.store.amq.AMQPersistenceAdapter.start(AMQPersistenceAdapter.java:207)
> at org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1597)
> at org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:1550)
> at org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:560)
> at org.apache.activemq.broker.BrokerService.start(BrokerService.java:455)
> Problem identified in this diff, the inUse set needs to be copied as it may be modified in parallel to the cleanup.
> Index: activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
> ===================================================================
> --- activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java        (revision 655936)
> +++ activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java        (working copy)
> @@ -411,7 +411,7 @@
>              }
>              Integer lastDataFile = asyncDataManager.getCurrentDataFileId();
>              inProgress.add(lastDataFile);
> -            Set<Integer> inUse = referenceStoreAdapter.getReferenceFileIdsInUse();
> +            Set<Integer> inUse = new HashSet<Integer>(referenceStoreAdapter.getReferenceFileIdsInUse());
>              asyncDataManager.consolidateDataFilesNotIn(inUse, inProgress);
>          } catch (IOException e) {
>              LOG.error("Could not cleanup data files: " + e, e);

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


[jira] Updated: (AMQ-1727) java.lang.IllegalStateException: Timer already cancelled caused by Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException and

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

Gary Tully updated AMQ-1727:
----------------------------

    Attachment: AMQ-1727.patch

a trivial fix that ensures that the Set of inUse ids will not be modified while it is being traversed to remove entries from the complete in use set.

> java.lang.IllegalStateException: Timer already cancelled caused by Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException and 
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-1727
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1727
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Message Store
>    Affects Versions: 5.1.0
>            Reporter: Gary Tully
>         Attachments: AMQ-1727.patch
>
>
> stack trace causes timer thread to abort:
> Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException
> at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
> at java.util.HashMap$KeyIterator.next(HashMap.java:877)
> at java.util.AbstractSet.removeAll(AbstractSet.java:143)
> at org.apache.activemq.kaha.impl.async.AsyncDataManager.consolidateDataFilesNotIn(AsyncDataManager.java:404)
> at org.apache.activemq.store.amq.AMQPersistenceAdapter.cleanup(AMQPersistenceAdapter.java:415)
> at org.apache.activemq.store.amq.AMQPersistenceAdapter$3.run(AMQPersistenceAdapter.java:267)
> at org.apache.activemq.thread.SchedulerTimerTask.run(SchedulerTimerTask.java:33)
> at java.util.TimerThread.mainLoop(Timer.java:512)
> at java.util.TimerThread.run(Timer.java:462)
> subsequent timer enqueue fails with:
> java.lang.IllegalStateException: Timer already cancelled.
> at java.util.Timer.sched(Timer.java:354)
> at java.util.Timer.scheduleAtFixedRate(Timer.java:296)
> at org.apache.activemq.thread.Scheduler.executePeriodically(Scheduler.java:38)
> at org.apache.activemq.kaha.impl.async.AsyncDataManager.start(AsyncDataManager.java:190)
> at org.apache.activemq.store.amq.AMQPersistenceAdapter.start(AMQPersistenceAdapter.java:207)
> at org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1597)
> at org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:1550)
> at org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:560)
> at org.apache.activemq.broker.BrokerService.start(BrokerService.java:455)
> Problem identified in this diff, the inUse set needs to be copied as it may be modified in parallel to the cleanup.
> Index: activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
> ===================================================================
> --- activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java        (revision 655936)
> +++ activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java        (working copy)
> @@ -411,7 +411,7 @@
>              }
>              Integer lastDataFile = asyncDataManager.getCurrentDataFileId();
>              inProgress.add(lastDataFile);
> -            Set<Integer> inUse = referenceStoreAdapter.getReferenceFileIdsInUse();
> +            Set<Integer> inUse = new HashSet<Integer>(referenceStoreAdapter.getReferenceFileIdsInUse());
>              asyncDataManager.consolidateDataFilesNotIn(inUse, inProgress);
>          } catch (IOException e) {
>              LOG.error("Could not cleanup data files: " + e, e);

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


[jira] Resolved: (AMQ-1727) java.lang.IllegalStateException: Timer already cancelled caused by Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException and

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

Rob Davies resolved AMQ-1727.
-----------------------------

    Fix Version/s: 5.2.0
       Resolution: Fixed

Patch applied by SVN revision 656582

> java.lang.IllegalStateException: Timer already cancelled caused by Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException and 
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-1727
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1727
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Message Store
>    Affects Versions: 5.1.0
>            Reporter: Gary Tully
>            Assignee: Rob Davies
>             Fix For: 5.2.0
>
>         Attachments: AMQ-1727.patch
>
>
> stack trace causes timer thread to abort:
> Exception in thread "ActiveMQ Scheduler" java.util.ConcurrentModificationException
> at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
> at java.util.HashMap$KeyIterator.next(HashMap.java:877)
> at java.util.AbstractSet.removeAll(AbstractSet.java:143)
> at org.apache.activemq.kaha.impl.async.AsyncDataManager.consolidateDataFilesNotIn(AsyncDataManager.java:404)
> at org.apache.activemq.store.amq.AMQPersistenceAdapter.cleanup(AMQPersistenceAdapter.java:415)
> at org.apache.activemq.store.amq.AMQPersistenceAdapter$3.run(AMQPersistenceAdapter.java:267)
> at org.apache.activemq.thread.SchedulerTimerTask.run(SchedulerTimerTask.java:33)
> at java.util.TimerThread.mainLoop(Timer.java:512)
> at java.util.TimerThread.run(Timer.java:462)
> subsequent timer enqueue fails with:
> java.lang.IllegalStateException: Timer already cancelled.
> at java.util.Timer.sched(Timer.java:354)
> at java.util.Timer.scheduleAtFixedRate(Timer.java:296)
> at org.apache.activemq.thread.Scheduler.executePeriodically(Scheduler.java:38)
> at org.apache.activemq.kaha.impl.async.AsyncDataManager.start(AsyncDataManager.java:190)
> at org.apache.activemq.store.amq.AMQPersistenceAdapter.start(AMQPersistenceAdapter.java:207)
> at org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1597)
> at org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:1550)
> at org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:560)
> at org.apache.activemq.broker.BrokerService.start(BrokerService.java:455)
> Problem identified in this diff, the inUse set needs to be copied as it may be modified in parallel to the cleanup.
> Index: activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
> ===================================================================
> --- activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java        (revision 655936)
> +++ activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java        (working copy)
> @@ -411,7 +411,7 @@
>              }
>              Integer lastDataFile = asyncDataManager.getCurrentDataFileId();
>              inProgress.add(lastDataFile);
> -            Set<Integer> inUse = referenceStoreAdapter.getReferenceFileIdsInUse();
> +            Set<Integer> inUse = new HashSet<Integer>(referenceStoreAdapter.getReferenceFileIdsInUse());
>              asyncDataManager.consolidateDataFilesNotIn(inUse, inProgress);
>          } catch (IOException e) {
>              LOG.error("Could not cleanup data files: " + e, e);

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