Description
The following stack was reproduced in AMQ 5.5.1 but not the Fuse Message Broker version.
Exception in thread "BrokerService[3561F026-E8F62746-2A202922-F17EADF0-7BCA8E67] Task-5053" java.util.ConcurrentModificationException jvm 1 | at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:373) jvm 1 | at java.util.LinkedHashMap$ValueIterator.next(LinkedHashMap.java:388) jvm 1 | at org.apache.activemq.broker.region.Queue.iterate(Queue.java:1376) jvm 1 | at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:127) jvm 1 | at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48) jvm 1 | at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) jvm 1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) jvm 1 | at java.lang.Thread.run(Thread.java:662)
This can happened only in the case where the optimizedDispatch mode is enabled and multiple producers are waiting for space. When the memory usage decreases and the notifications are run from the iterate() method the method can be called recursively leading to the error as items are removed from the messagesWaitingForSpace map.