Mekanism

Mekanism

111M Downloads

MekanismTools - ConcurrentModificationException with EnergyNetwork

Sintamo opened this issue ยท 8 comments

commented

Occurs when placing down blocks that have to do with energy. In this case a user was placing a line of glow panels, but it happens with advanced solar panels as well. It seems that placing too many at a time, such as a row of 10 panels in succession, causes the server to crash. In build 83, it is a light crash, the client is disconnected but the server stays online. However, in build 84 the server completely shuts down.

Server crash log: http://pastebin.com/wvtAmuXC

commented

On build 86, the server now crashes when players leave the game as well. It doesn't happen every time, but i'd say around 80% of the time the server crashes with the above error when player log out.

commented

It seems that, using build 86 and Forge 199, the error only happens when MekanismTools is installed. Which is weird, since the tools ought to have nothing to do with energy.

commented

And if Glow Panels were involved with the light client crash, it's something else. They have no relation to the energy system.

commented

I just talked with a few people on IRC - E.Beef suggested that getAcceptors() is somehow calling a refresh of the network which makes sense. One thing that he mentioned was a tick-based refresh system, so that refresh requests could be only called at max once per tick. What do you think?

commented

I'm not sure how that could happen, but I guess it's plausible. Changing the current refresh methods to just set a flag, then actually performing the refresh on tick when the flag is set seems like a good solution for efficiency reasons too, though, so probably worth doing.

commented

i'm getting this also http://pastebin.com/Y1EsFbrB

commented

Fixed in development, but by very inefficient means (copying the map of acceptors). Closing, but I really wish we could find what was causing this issue in the first place.
@unpairedbracket, do you have any idea how we could fix this WITHOUT copying the map? It's a CME which means that the map of possible acceptors is somehow being modified while it's being iterated over. It seems to be a server-only crash, but that makes it even more strange - the networks are only accessed by a single thread.

commented

I don't really know a lot about java thread-safety, but would it work to synchronize clearAround, clearIfNecessary and fullRefresh in DynamicNetwork?