OreCruncher / DynamicSurroundingsFabric

Dynamic Surroundings mod for Minecraft
MIT License
62 stars 25 forks source link

[1.20.x] Crash due to concurrent access of randomizer #87

Closed FaeWulf closed 4 months ago

FaeWulf commented 4 months ago

crash-2024-02-13_13.41.17-client.txt

Version 1.20,4 - 0.3.2

OreCruncher commented 4 months ago

What modpack, and how often does it occur?

FaeWulf commented 4 months ago

What modpack, and how often does it occur?

Lastest fabulously optimized. I don't know what triggering it, not very often, it is very random (sometimes crashed while walking on ice berg, sometimes crashed while building base...)

P/s: I have read stacktrace but have no idea what triggers it.

OreCruncher commented 4 months ago

My mod is a client side mod, meaning my logic executes on the render thread (well, mostly). This crash is telling me that there is another thread that is trying to use a randomizer instance that I created for the render thread, which is something that should not be occurring. I would imagine this issue would be infrequent and occur randomly just as you are experiencing.

EDIT: I think I know what it is. In modern minecraft sounds now have a random instance associated with them. This random could be accessed by an "off thread" in the sound engine. I am using a shared random in the context. Need to rearrange code and add some defenses.

OreCruncher commented 4 months ago

Pushed update 0.3.3 to CurseForge and Modrinth.