Skip to content

fix: WorldTickManager dynamic lifecycle, AsyncEntityTracker latch exception safety, and SpawnerCreature spectator filtering - #163

Open
GamingOP69 wants to merge 7 commits into
Wind-Development:masterfrom
GamingOP69:fix/world-tick-and-entity-tracker
Open

fix: WorldTickManager dynamic lifecycle, AsyncEntityTracker latch exception safety, and SpawnerCreature spectator filtering#163
GamingOP69 wants to merge 7 commits into
Wind-Development:masterfrom
GamingOP69:fix/world-tick-and-entity-tracker

Conversation

@GamingOP69

Copy link
Copy Markdown

Summary

Fixes memory leaks and index errors with dynamically loaded/unloaded worlds (Multiverse), prevents AsyncEntityTracker latch deadlocks during exceptions, and corrects spectator filtering and mob cap counting in SpawnerCreature.

Problem & Root Cause

  • WorldTickManager cached world tickers against a static list size rather than delegating to live MinecraftServer.worlds. When worlds were dynamically loaded or unloaded at runtime by world management plugins, the ticker list became desynchronized, leading to memory leaks and tick index errors.
  • AsyncEntityTracker worker tasks did not perform latch.countDown() inside a finally block. If an entity tracker threw an exception during tracking, the countdown latch would never reach zero, deadlocking the main server thread waiting on the latch.
  • EntityTrackerEntry had an artificial 5-second tracking delay check that caused delay in players rendering when teleporting or entering view range.
  • SpawnerCreature had an inverted spectator mode check and miscalculated mob caps by counting active chunks incorrectly.

Solution

  • Refactored WorldTickManager to iterate live worlds from MinecraftServer.getServer().worlds and clean up tickers when worlds are unloaded.
  • Placed AsyncEntityTracker latch countdowns in finally blocks to guarantee release under all conditions.
  • Restored responsive entity tracking rates in EntityTrackerEntry.
  • Fixed spectator check and active chunk calculation in SpawnerCreature.
  • Added unit and regression tests: WorldTickManagerLifecycleTest, AsyncTrackerLatchRegressionTest, and MobSpawningCapTest.

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