Closed lesquoyb closed 1 month ago
Two solutions here :
1) The solution you propose is more or less exactly what the synchronised: true
already does, so you can use this.
2) If you don't want to synchronise the simulation and the display, then you expose yourself to these errors (no real way to avoid them), and in that case, you have to accept that some display steps may be missed or wrong, which is why the preference pref_display_show_errors
exists. Turning it to false will get rid of the errors.
Describe the bug
It is a recurrent issue that some models throw
ConcurrentModificationException
when running for no apparent reason (no real modification in the code of the aspect).Usually it's pretty random and some models are more prone to it than others but it's hard to reproduce consistently. I found a model in the library for which the issue arises all the time (on my computer):
Graph From Bug (Mirror Graph).gaml
Typically it would throw a few errors while running normally:Then after some time and playing with the Distance parameter the ConcurrentModificationException appears and stops the execution:
Expected behavior Get rid of those ConcurrentModificationException (not just in this example model)
Additional context I guess that the issue is that drawing being independent from the engine, the code in the aspect can be executed during a change of the variables in the simulation resulting in that issue. Maybe the "simplest" currently to get rid of this would be to have the draws executed on a fixed state of the simulation and not accessing live variables ? But it's probably going to have a cost on performances. Maybe we could use the already existing serialization to work on the previous step btw ?