Industrial Revolution

Industrial Revolution

5M Downloads

[BUG] Loading screen stuck at 100%

rmuchan opened this issue ยท 3 comments

commented

Description:
Sometimes when I join a singleplayer world, it get stuck at 100%. As far as I tested, this doesn't happen the first time I join a world after launching the game.

image

Steps to Reproduce:

  • Create a world
  • Place a LF container
  • Save & quit to title, but don't quit game
  • Join the world again

Technical Information:

  • Minecraft: 1.16.5
  • Fabric API: 0.30.3
  • Industrial Revolution: 1.8.9
  • Modpack: IR and the 2 dependencies

Logs:
https://pastebin.ubuntu.com/p/pTKw3mKZX8/

Details:
Thread dump: https://pastebin.ubuntu.com/p/2t6mZRwXYF/
Server thread is joining a Future. This doesn't seem right because class_3215.method_12121 or ServerChunkManager.getChunk shouldn't execute this branch on server thread in the first place.

commented

This has been known for a while now but I wasn't able to pin point what actually causes it. This has helped me notice it's related to the ticking of the machines and energy networks (related to the getBlockState methods apparently?). I tried adding a 1 second delay for them to start ticking but then it consistently gets stuck on the saving phase the second time you try to leave the world... I still don't know how to actually fix this

commented

Thanks a lot for the thread dump, I didn't know this was possible to do, and it helped me troubleshoot this issue.

Server thread is joining a Future. This doesn't seem right because class_3215.method_12121 or ServerChunkManager.getChunk shouldn't execute this branch on server thread in the first place.

That was indeed correct. There was a static HashMap<BlockPos, BlockApiCache<EnergyIo, Direction>> used for energy networks which was meant to be per-world and not global. In particular, the cache kept a reference to an older world, meaning that attempting to get energy in a new world at an existing position would use the old cache, linked to the old world, linked to another server instance, causing a deadlock, and also causing the Thread.currentThread() != this.serverThread check at the beginning of ServerWorldManager#getChunk to fail somehow! Phew, that was a nasty one! ๐Ÿ˜„

commented

in short I fucked up again, thank you both for the help! I'll release a version on CF with the fix.