Mekanism

Mekanism

111M Downloads

Thread safety issue

sfPlayer1 opened this issue ยท 1 comments

commented

Mekanism calls World.getTileEntity, which isn't thread safe, from a thread (ThreadSparkle). This will cause sporadic corruption and crashes.

See http://pastebin.com/4Y0ybika for a stack trace where it modifies collections from a thread. Reading collections from a thread isn't universally safe either.

Such a world access heavy task isn't particularly suitable for asynchronous execution. Run it synchronously, use a temporary ChunkCache instance and convert the recursion to iterative breadth first search to fix performance problems, assuming there were even some in the first place...

commented

I've changed the animation to run in client thread timing which should solve the access issues. In testing, I wasn't able to experience any delay in the process.