Java Error: ConcurrentModificationException

34 views
Skip to first unread message

Marta García

unread,
Oct 11, 2021, 4:37:49 AM10/11/21
to GAMA
Dear all,

I've been dealing with the error - 2 occurrences in 2 agents at cycle X: Java Error: ConcurentModificationException (image below)
This error occurs at different cycles. I spotted the line which is responsible for the error, but I didn't get why and how to overcome it. This happens in the move function when I try to export the agents' variables:

reflex move when: the_target != nil {
        do drive;
        my_road <- road closest_to self;
        string file_name <- "../includes/output/drivers_" +driver.name;
        save "" + self.name + "\t" + model_time + "\t" + my_road.name+"\t"+ self.real_speed +"\t"+ self.objective  to: file_name+".csv" type: "text" rewrite: false;           
               
At first, that line was saving everything to one file (without the driver.name in defining the file_name). I thought that this was happening because of the parallelization - that two agents' variables tried to write them in the same file's line, so I make it saving to files for each agent individually (as it is shown above). However, I've still got it. The next clue was that specific attribute was responsible. So I tried to save only agents' name, still got it. Then I created a new reflex for exporting the attributes, didn't resolve it.
This error usually happens after few created files.

The model is pretty much similar to the example in the library which demonstrates the functioning of advanced traffic. The timestep is one second.

If someone can help me to understand why is it happening and how to solve it (without erasing the save functionality, I really need it :D ), I would be so grateful! I am dealing with it for quite of time, I am starting to be desperate. I am not a Java or OO programmer, so it making me difficult to understand it.

Thank you in advance!!

Capture.PNG

Alexis Drogoul (IRD)

unread,
Oct 11, 2021, 6:40:09 AM10/11/21
to gama-p...@googlegroups.com
Hi,

You are clearly facing a serious bug that seems to be caused by the removal of elements in a list while the list is being browsed, or a similar error. 

Could you turn it into an issue here: https://github.com/gama-platform/gama/issues ? 

(and detail the model and the version of GAMA you are using : it's clearly not the latest one).

Cheers
Alexis

<Capture.PNG>

--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gama-platform/9d6c0a40-faba-476a-8638-7ef2a584549cn%40googlegroups.com.
<Capture.PNG>

Marta García

unread,
Oct 11, 2021, 11:52:12 AM10/11/21
to GAMA
Dear Alexis,

Thank you for your quick responce! I will post the issue.
Based on this page, I think it's the latest version. I am using 1.8.1 with JDK. I downloaded it now again and same error appeared. Should I use the daily build?
Nevertheless, can you suggest a workaround until programmers solve the issue?

Best regards!
Reply all
Reply to author
Forward
0 new messages