Lithium (Fabric/NeoForge)

Lithium (Fabric/NeoForge)

38M Downloads

[1.21.1 Fabric] Lithium causes the server to deadlock internally when generating structures from Repurposed Structures

TelepathicGrunt opened this issue ยท 12 comments

commented

Version Information

lithium-fabric-0.14.3-snapshot+mc1.21.1-build.92

Expected Behavior

I am the dev of Repurposed Structures mod that spawns additional structures in the world. It is expected that my structures generate without issues or any deadlocking.

Actual Behavior

A user reported to me that their game is deadlocking where chunks stop loading and server logic stop running. After a long and tedious time of disabling mods, I narrowed down the issue to Lithium. Disabling Lithium stops the deadlocking
TelepathicGrunt/RepurposedStructures#369

Reproduction Steps

  1. Put on Lithium and Repurposed Structures
  2. Create a world with seed 2438457204829392124
  3. Teleport to 800, 120, 200
  4. Move towards 1000, 120, 200
  5. Notice that chunks stop loading. Mobs stop working.
  6. Check latest.log to see no crash or errors.
  7. Do a thread dump like this https://pastebin.com/raw/bNaTw5n4 and you will see no worldgen threads are running code. Just the server thread was trying to grab a chunk and is locked up waiting on that chunk.
  8. Repeat by disabling either mod and see the issue does not happen.
commented

Seems like even with empty config file the issue occurs in my dev environment.

commented

Confirmed that it is the same chunk that it is accessing. Recently I noticed that Neoforge has a patch for exactly this case, so it might actually be unrelated to lithium

commented

I think the comment here hints at a chunk loading operation loading the same chunk. method_12206 is runPostLoad in Mojmap. It appears entities that are riding other entities are loaded in, triggering a game event, triggering a vibration listener, triggering a chunk access.
This might be related to lithium's dispatcher optimization

commented

If the user has manually enabled the option mixin.world.game_events.dispatch, which is disabled by default in 0.14.3, I suggest disabling that option for now.

commented

It doesn't really make a difference whether the chunk is reloaded or being generated I think. I guess you have tested this structure without lithium already. Can you quickly confirm whether the dispatcher setting is enabled in the lithium.properties file?

commented

The chunk in question is xz 57,20. The chunk that is receiving the game event is xz 57,19. The passenger (skeleton) is in 57,20 and the vibration listener is a sculk sensor in 57,19. I don't believe this is related to lithium, will test without.

commented

Confirmed with all Lithium mixins disabled

commented

What is the neoforge patch that fixes this

commented

@TelepathicGrunt GenerationChunkHolder has the additional field public LevelChunk currentlyLoading;
The fix is kind of a hack, since it allows chunk accesses before the chunk is actually loaded. The actual fix for your issue would be to prevent loading entities causing game events

commented

Since this bug has also been bothering me, I will create a small bugfix mod that fixes this

commented

Image