Skip to content

faq 305135621

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

Crashing with Broken barrier exception

by Ashraf Uz Zaman Patwary on 2018-07-26 13:23:23


Hello everyone,

I am trying to run MATSim in a loop and in some of the iterations MATSim is crashing with the following error.

2018-07-26 20:55:55,394 ERROR SimStepParallelEventsManagerImpl$ExceptionHandler:420 Thread class org.matsim.core.events.SimStepParallelEventsManagerImpl$ProcessEventsRunnable4 died with exception while handling events.

java.lang.RuntimeException: problem invoking EventHandler org.matsim.core.events.algorithms.Vehicle2DriverEventHandler for event-class org.matsim.api.core.v01.events.VehicleLeavesTrafficEvent at org.matsim.core.events.EventsManagerImpl.computeEvent(EventsManagerImpl.java:230) at org.matsim.core.events.EventsManagerImpl.processEvent(EventsManagerImpl.java:136) at org.matsim.core.events.SimStepParallelEventsManagerImpl$ProcessEventsRunnable.run(SimStepParallelEventsManagerImpl.java:330) at java.lang.

And finally the simulation throws the BrokenBarrierException

2018-07-26 21:00:09,589 ERROR SimStepParallelEventsManagerImpl$ExceptionHandler:420 Thread class org.matsim.core.events.SimStepParallelEventsManagerImpl$ProcessEventsRunnable0 died with exception while handling events. java.lang.RuntimeException: java.util.concurrent.BrokenBarrierException at org.matsim.core.events.SimStepParallelEventsManagerImpl

As this is not happening in every iteration of the loop, I am in a fix about how to solve the problem.

Please help.

Thanks in advance.


Comments: 2


Re: Crashing with Broken barrier exception

by Kai Nagel on 2018-07-30 11:24:12

Thanks for adding the logfile. The actual error is further above,

java.lang.ClassCastException: java.util.HashMap$Node cannot be cast to java.util.HashMap$TreeNode

Other people seem to have the same problem, e.g. https://bugs.openjdk.java.net/browse/JDK-8078646 . At first glance it looks like a bug, but in reality it seems a problem with concurrency. I am not an expert with threads, so maybe someone else can come to the rescue. In the matsim HEAD I will change the offending data structure from HashMap to ConcurrentHashMap in the hope that that will fix the issue, but I have no way to verify that. And it will take some time through regression tests before it will show up in the maven snapshot.

In the meantime, could maybe setting the number of parallel events handlers to "1" help?


Re: Crashing with Broken barrier exception

by Ashraf Uz Zaman Patwary on 2018-08-01 03:51:16

Thanks for the answer.

As, I have a lot of agents (around 4 million) this will make the simulation very slow. I would try your suggestion and hope the simulation do not loose much speed.

Regards.

Clone this wiki locally