MaxNeedsSnacks / roadrunner

A general-purpose performance mod and fork of the popular "Lithium" mod made for the Forge mod loader.
GNU Lesser General Public License v3.0
24 stars 5 forks source link

client crash in enigmatica 6 #3

Closed theboo closed 3 years ago

theboo commented 3 years ago

placed an array of IF mechanical dirt and attached a creative energy cube from mek, crashed with this:

https://gist.github.com/theboo/6f6bb95c682236fbacdf986dfc001caa

enigmatica 6 modpack v0.5.14

malte0811 commented 3 years ago

It seems to be a race condition, here's the other side of it: https://gist.github.com/malte0811/a400bf26fae4a910eb854fd82ce1e478
You don't want to know how long it took to actually get that stack trace…

Edit: Thinking about it (right after posting the comment, go figure), this can at least theoretically happen in vanilla as well. tickableTileEntities/tickingBlockEntities is just a plain ArrayList without RR, so calling add off-thread has no guarantees. RRs list is just much more sensitive to concurrent access.

malte0811 commented 3 years ago

We probably need to do something about this on our side, but as it can (at least in theory) happen in vanilla @Meldexun may be interested in it as well.
Worst case we can add a "current thread == expected thread" assertion to all modifying methods (Entity Culling catches and ignores any exception thrown during its off-thread world access), I'll need to check how slow Thread.currentThread() is these days before we do that. And whether throwing an exception at that point while adding a block entity will break anything else…

MaxNeedsSnacks commented 3 years ago

We're removing Block Entity Sleeping in 1.2.0, so this should be resolved by then