Fix game not exiting after using the multithreaded crafting planner - #231
Merged
Merged
Conversation
The crafting planner worker pool used non-daemon threads that were never shut down. Since the 26.3 client no longer calls System.exit on quit, these threads kept the JVM alive when craftingPlannerEnableMultithreading was enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vnbsy6rjJEtuZqgw36BQ7d
Coverage Report for CI Build 37128810238Coverage increased (+0.07%) to 27.532%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions35 previously-covered lines in 2 files lost coverage.
Coverage Stats
💛 - Coveralls |
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.
Problem
ContainerTerminalStorageCraftingPlanBase.WORKER_POOLis created withExecutors.newFixedThreadPool. That pool uses non-daemon threads and is never shut down.The MC 26.3 client no longer calls
System.exit(0)on quit, and the vanilla shutdown watchdog fallback crashes on NeoForge (FML closes theminecraftmodule first). So once a crafting plan has been computed withcraftingPlannerEnableMultithreading=true, quitting the game hangs forever. The option is off by default.This is the same issue as CyclopsMC/IntegratedDynamics#1758.
Fix
Use a daemon
ThreadFactoryfor the pool, and give the threads names.Tests
GameTestCraftingPlanWorkerPool#testWorkerThreadsAreDaemon. I checked that it fails withsetDaemon(false)and passes with the fix../gradlew buildpasses, andrunGameTestServerpasses all 84 required tests.🤖 Generated with Claude Code
https://claude.ai/code/session_01Vnbsy6rjJEtuZqgw36BQ7d
Generated by Claude Code