Skip to content

Fix game not exiting after using the multithreaded crafting planner - #231

Merged
rubensworks merged 1 commit into
master-26from
fix-crafting-planner-daemon-threads
Oct 3, 2026
Merged

rubensworks merged 1 commit into
master-26from
fix-crafting-planner-daemon-threads

Conversation

@rubensworks

Copy link
Copy Markdown
Member

Problem

ContainerTerminalStorageCraftingPlanBase.WORKER_POOL is created with Executors.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 the minecraft module first). So once a crafting plan has been computed with craftingPlannerEnableMultithreading=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 ThreadFactory for the pool, and give the threads names.

Tests

  • New game test GameTestCraftingPlanWorkerPool#testWorkerThreadsAreDaemon. I checked that it fails with setDaemon(false) and passes with the fix.
  • ./gradlew build passes, and runGameTestServer passes all 84 required tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vnbsy6rjJEtuZqgw36BQ7d


Generated by Claude Code

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
@coveralls

coveralls commented Oct 3, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 37128810238

Coverage increased (+0.07%) to 27.532%

Details

  • Coverage increased (+0.07%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 35 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

35 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
org/cyclops/integratedterminals/inventory/container/ContainerTerminalStorageCraftingPlanBase.java 30 6.85%
org/cyclops/integratedterminals/IntegratedTerminals.java 5 90.57%

Coverage Stats

Coverage Status
Relevant Lines: 7866
Covered Lines: 2421
Line Coverage: 30.78%
Relevant Branches: 2649
Covered Branches: 474
Branch Coverage: 17.89%
Branches in Coverage %: Yes
Coverage Strength: 1.57 hits per line

💛 - Coveralls

@rubensworks
rubensworks merged commit e8f7f6e into master-26 Oct 3, 2026
3 checks passed
@rubensworks
rubensworks deleted the fix-crafting-planner-daemon-threads branch October 3, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants