AEModernMCPort / Applied-Energistics-3-Fork

A Minecraft Mod about Matter, Energy and using them to conquer the world..
http://ae-mod.info/
Other
37 stars 12 forks source link

Cable Multipart Rendering is not Thread-Safe #83

Closed shartte closed 7 years ago

shartte commented 8 years ago

Chunks are rebuilt on a thread separate from the main thread. Simply passing a reference to CableBusContainer to the IBakedModel via an unlisted property will lead to race conditions and other concurrency bugs, when the state of the cable bus container is updated concurrently with a chunk update.

shartte commented 8 years ago

This has to be confirmed a bit more. I was thinking about it some more and came the conclusion that it might currently be called from a thread, but the main thread might still wait for that thread to complete before it continues processing network packets.

It should still be investigated.

yueh commented 8 years ago

It will be an issue (it was already one in 1.8 port).

But the rendering is a bit more complex. It is not always multithreaded. Nearby chunks are handle by the main thread and only farther away chunks are handed of to the multithreaded rendering.

It is also possible to even defer the model backing. Chisels & Bits has a multi threaded model baker, which is able to bake the model and replace it afterwards while not blocking anything else.

Elix-x commented 7 years ago

Applied Energistics is currently in not-compile-able state, with many changes ahead. Once AE can be run, confirm that this is still a bug and open a new issue (or reopen this one).