The Twilight Forest

The Twilight Forest

155M Downloads

singleplayer deadlock caused by cloud precipitation hook

VaporeonScripts opened this issue ยท 8 comments

commented

NeoForge Version

.197

Twilight Forest Version

4.7.3196

Client Log

https://mclo.gs/A107WW6

Crash Report (if applicable)

https://mclo.gs/A107WW6

Steps to Reproduce

make a world with both c2me and twilightforest ig

What You Expected

normal gameplay

What Happened Instead

world deadlock

Additional Details

https://mclo.gs/A107WW6
also gemini points out this:

The Cause of the Hang

Here is a step-by-step breakdown of what is happening:

Your server is generating a new chunk of the world. C2ME offloads this task to a worker thread (c2me-worker-2) to prevent lag.

As part of generating the chunk, the game tries to place a structure and spawn a mob inside it (StructureTemplate.addEntitiesToWorld).

When the mob is about to spawn, NeoForge fires a finalizeMobSpawn event.

This rain check is intercepted by The Twilight Forest mod (ASMHooks.isRainingAt).

To check the weather, the game needs to access information from the chunk at that location (Level.getChunkAt).

Here is the problem: The worker thread, which is already busy generating one chunk, is now being asked to load another chunk to perform the rain check. This creates a deadlock. The system is waiting for a resource (the new chunk) that cannot be provided because the thread that would help provide it is the one that's frozen, waiting.

The result is that the c2me-worker-2 thread gets stuck waiting indefinitely, and because the main server thread is waiting for the world generation to finish, the entire server tick freezes for over 121 seconds until the watchdog steps in.

Please Read and Confirm The Following

  • I have confirmed this bug can be replicated without the use of Optifine.
  • I have confirmed the details provided in this report are concise as possible and does not contained vague information (ie. Versions are properly recorded, answers to questions are clear).
  • I have confirmed this issue is unique and has not been reported already.
commented

If you wouldnt mind, could you go to TF's Common config (twilightforest-common.toml) and turn cloudBlockPrecipitationDistance to 0 and try again? I have a hunch but it needs some testing.

Also for the love of GOD do not ever attach an AI analysis to any crash report ever again. It is the opposite of helpful, I know how to read crash reports and AI does not know what its doing

commented

oh alright, my bad, btw the deadlock happens on a fresh world in the OVERWORLD when loading some chunks at some point

commented

yes I know, I think one our asm hooks for cloud precipitation may be causing problems. Hence why i asked you to change that config and see if it does anything, it should disable the checks

commented

yeah, im booting up the game right now, i'll generate a world rq

commented

as of now it doesnt look like its having issues, im gonna try a little bit more

commented

yeah, no issues as of now, might be fixed? dont know

commented

alright if that fixed it I at least know what to look into. Let me know if it locks up again and send another log if it does

commented

I will, ima try for like 30 mins tomorrow since now i won't be home