Skip to content

faq 123961374

Billy Charlton edited this page Sep 5, 2018 · 2 revisions

ConcurrentModificationException in events handling?

by Kai Nagel on 2017-11-20 12:20:47


Hello, does someone have an intuition where this here might come from:

2017-11-20 11:51:56,780  INFO EventsManagerImpl:134  event # 32768
 2017-11-20 11:51:58,257 ERROR SimStepParallelEventsManagerImpl$ExceptionHandler:419 Thread class org.matsim.core.events.SimStepParallelEventsManagerImpl$ProcessEventsRunnable0 died with exception while handling events.
 java.util.ConcurrentModificationException
 	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:907)
 	at java.util.ArrayList$Itr.next(ArrayList.java:857)
 	at io.github.agentsoz.bdimatsim.EventsMonitorRegistry.callRegisteredHandlers(EventsMonitorRegistry.java:109)
 	at io.github.agentsoz.bdimatsim.EventsMonitorRegistry.handleEvent(EventsMonitorRegistry.java:82)
 	at org.matsim.core.events.EventsManagerImpl.callHandlerFast(EventsManagerImpl.java:291)
 	at org.matsim.core.events.EventsManagerImpl.computeEvent(EventsManagerImpl.java:222)
 	at org.matsim.core.events.EventsManagerImpl.processEvent(EventsManagerImpl.java:136)
 	at org.matsim.core.events.SimStepParallelEventsManagerImpl$ProcessEventsRunnable.run(SimStepParallelEventsManagerImpl.java:329)
 	at java.lang.Thread.run(Thread.java:748)
 

I think that I have the number of all threads (qsim, gbl, parallelEventsHandling) at one, but I just saw this on the build server (while having non-deterministic tests since weeks now), so I cannot investigate easily.

Thanks ...

(and I don't know why it is not accepting the logfile as attachment ... :-( ...)


Comments: 1


Re: ConcurrentModificationException in events handling?

by Marcel Rieser on 2017-11-20 13:53:33

The exception does not occur within "standard MATSim", but in io.github.agentsoz.bdimatsim.EventsMonitorRegistry. Not knowing, what this code exactly does, it's hard to pinpoint the problem, but some guess:

With parallel events handling, two events (likely of different types) get handled in parallel, but both use the EventsMonitorRegistry somehow to process the events, so they both access the same instance of the class which then leads to the Concurrent Modification Exception.

It's just a guess, though…

Clone this wiki locally