Crash with ConcurrentModificationException
andriihorpenko opened this issue ยท 7 comments
Under unknown circumstances, I get a ConcurrentModificationException crash, which points to refreshAllMachines
method. Adding a crash report below.
Players are not allowed to use "/reload" command, but your mod somehow reads "/reload" command and actually does a reload of all machines. This bypasses any permission checks.
The only way to get that crash would be that a /reload was performed at the exact same time as another server thread was adding a machine to that list, maybe if a chunk containing a machine is loaded.
I will make that list thread-safe and that should fix this issue.
About the perms I actually listen to an event that (I thought) is sent only when the command is performed, idk why the reload still happen if the player is not opped, will dig more into that.
The players perms issue is fixed in the latest update (0.8.4).
The ConcurrentModificationException crash should be fixed too, but I can't be 100% sure as that kind of bug is pretty much impossible to reproduce. I will close this for now but if that still happen upload a new crash report here and I will reopen this issue.
Damn I'm really bad at fixing concurrency issues x)
I did another try here, can you test it and tell me if that still happen somehow.
CustomMachinery-forge-1.19.2-0.9.7.zip
(don't forget to unzip the file, github doesn't support sending jar files directly)
Concurrency is always pretty tricky haha ;)
I will install this build soon and let you know what I get, but due to the nature of the bug, I am afraid a reply might take quite some time.
Seems like the issue persists:
crash-2023-12-08_14.31.19-server.txt
This happened once I ran /reload
. I've noticed that it's more likely to reproduce when you have a lot of machines.