Force System.exit(0) after SdlApplication returns to prevent zombie processes#12222
Open
DeterMination-Wind wants to merge 1 commit into
Open
Force System.exit(0) after SdlApplication returns to prevent zombie processes#12222DeterMination-Wind wants to merge 1 commit into
DeterMination-Wind wants to merge 1 commit into
Conversation
…rocesses on Windows On Windows, SDL_GL_SwapWindow can block indefinitely after the window is closed, preventing the main thread from returning. Since all other threads are daemon threads, the JVM cannot exit naturally. Adding System.exit(0) ensures the process terminates regardless of native thread state. Fixes Anuken#12221
|
I agree, there is such a thing, sometimes I manually closed java(w).exe after the game |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
System.exit(0)at the end ofDesktopLauncher.main()to force JVM exit afterSdlApplicationreturnsProblem
On Windows, closing the Mindustry window can leave a zombie
javaw.exeprocess. The main thread gets stuck inSDL_GL_SwapWindow(native) and never returns. All other threads are daemon threads, so the JVM waits indefinitely.jstack of zombie:
Fix
System.exit(0)after the try-catch block inmain(). This is the standard approach used by libGDX's LWJGL3 backend. TheSdlApplicationconstructor handles all cleanup (dispose,SDL_DestroyWindow,SDL_Quit) before returning, soSystem.exit(0)is safe here.Fixes #12221