Skip to content

Fix out of memory crash when pausing game - #93

Open
MateusF03 wants to merge 1 commit into
iSeeEthan:unifiedfrom
MateusF03:fix-pause-error
Open

Fix out of memory crash when pausing game#93
MateusF03 wants to merge 1 commit into
iSeeEthan:unifiedfrom
MateusF03:fix-pause-error

Conversation

@MateusF03

@MateusF03 MateusF03 commented Aug 8, 2026

Copy link
Copy Markdown

Fixes #91

ChunkGenerationManager.initialize() resets pauseCheck back to its default:

public void initialize(MinecraftServer server) {
    sessionId.incrementAndGet();
    this.server = server;
    this.running.set(true);
    this.pauseCheck = () -> false;   // <-- overwrites the client's registration
    Config.load();
    this.throttle = new Semaphore(Config.DATA.maxActiveTasks);
    startWorker();
    ...
}

Even though that pauseCheck is already set to the default value of false when creating the class. And since this initialization function is run after onInitializeClient from the class VoxyWorldGenV2Client, setPauseCheck is ignored. You can verify this yourself in any log from the game: the mod's initializing voxy world gen v2 client line (from the client entry point) appears near the top of the log during startup, while server started, initializing manager appears later, each time you load a world.

This fix was verified on 26.2 using both Fabric and NeoForge. The worker stops dispatching new generation tasks while the pause menu is open after this change, and the heap stays stable over a long paused session that previously would OOM.

Summary by CodeRabbit

  • Bug Fixes
    • Preserved the existing pause-check behavior when initializing chunk generation, preventing previously configured pause controls from being unintentionally reset.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2e55f9d7-a25f-4733-87e2-62f28feb9b0e

📥 Commits

Reviewing files that changed from the base of the PR and between d1c6372 and 6a00558.

📒 Files selected for processing (1)
  • common/src/main/java/com/ethan/voxyworldgenv2/core/ChunkGenerationManager.java

📝 Walkthrough

Walkthrough

ChunkGenerationManager.initialize now preserves the configured pauseCheck callback instead of replacing it with an always-false callback.

Changes

Chunk generation pause handling

Layer / File(s) Summary
Preserve configured pause callback
common/src/main/java/com/ethan/voxyworldgenv2/core/ChunkGenerationManager.java
Initialization no longer resets pauseCheck, so the existing pause state callback remains active.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

I’m a rabbit with a pause-check tune,
No callback lost beneath the moon.
The chunks now heed the signal bright,
And wait through worlds of quiet night.
Hop, hop—initialization stays right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: preventing an out-of-memory crash when the game is paused.
Linked Issues check ✅ Passed The change preserves the pause callback, so world-generation tasks stop during the singleplayer pause menu as required by [#91].
Out of Scope Changes check ✅ Passed The single-line change directly addresses pause handling and contains no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MateusF03

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

1 participant