Fix thread leak hanging shutdown on 26.2#2975
Conversation
Move Session Manager to PlatformManager and shut it down with unready event. Fix SessionManager#unload canceling timer, which prevents automatic saving of sessions after quitting a singleplayer world once.
|
I'm a bit confused by this PR, is this specifically an issue on a certain platform? I've been using Fabric with WorldEdit installed while joining a server to test the Bukkit version of WorldEdit on 26.2 and never hit this issue, and from a quick test of just launching the game in both NF & Fabric to the menu and closing it I cannot reproduce any issues. Can you please elaborate on what about 26.2 has caused this problem? |
|
Are you using the normal launcher? The This is the crash: https://pastebin.com/9kgejvG0 When using I also did some more testing and it seems the executor service doesn't seem to cause a crash, but the timer is. Either way, they should be shutdown cleanly. |
|
So I did some investigation after some information from someone in the Discord helped me actually reproduce this. From what I can tell, the actual "hang then crash on the client on exit" is not caused by WorldEdit, but the copy of Fabric API that we bundle in jar-in-jar. I was able to replicate the issue without WorldEdit, but the contents of I was also only able to replicate it by putting an old GPU into my machine (GTX 1080) and setting the graphics API to Vulkan. OpenGL did not lead to this crash, and neither did my typical GPU (RTX 5070). It seems like this is a bug in Fabric, rather than in WorldEdit itself, especially as WorldEdit runs on the logical server and doesn't interface with graphical APIs at all. Whether there are improvements we can make to the lifecycle or not is a different question though, but that seems unrelated to the crash people are reporting. Edit: Crash report without WorldEdit installed if it's helpful for anyone else, https://mclo.gs/b4afEZM Current theory is there's some quirk with specifically this old version of Vulkan, but unsure why it triggers this issue, as nothing else is really making sense. |
|
Yours seems like a different issue, as ours (OP and I) clearly state this kind of blocking task : And I can't reproduce that crash as soon as I remove WorldEdit so... (and still using OpenGL and with a RTX4080 |

Since 26.2, the client (and possibly server?) waits for threads to exit before closing. Crashing after a short time.
This pull fixes a bug where SessionManager didn't properly shut down.
Cause:
SessionManager#unloadis never called.SessionManager#unloaddoes not shutdown the executor, causing the client to time out and crash when waiting for it to exit anyway.Fixes:
SessionManager#unloadcanceling timer and no longer auto-saving after quitting a world.SessionManager#unloadDraft reason:
I'm making this as a draft for now as I'm not entirely sure what consequences of making the session manager dependent on Ready/Unready event are.
I smoketested it on all platforms but that doesn't really say much.
Could someone with some knowledge of when SessionManager is supposed to be available chime in?
The only other thing I want some insight on was the effects of ScheduledExecutorService using an unbounded DelayedWorkQueue and the original used a bounded-queue of 5. Unless I'm missing something I don't think this will cause issues?