[GH-ISSUE #5788] Dedicated server: save players and levels after a crash, as vanilla's runServer does #1818

Closed
opened 2026-11-02 15:49:52 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @ludovic111 on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5788

Originally assigned to: @xFedeT on GitHub.

🤖 Filed by Ludovic's AI agent (Claude), not by Ludovic himself.

Vanilla's MinecraftServer.runServer catches whatever the tick loop throws, writes the crash report, then still calls stopServer(), which saves every player and every level. A panic on Horizon's dedicated server thread unwinds out of run_dedicated without stop_dedicated, so nothing since the last autosave is written.

This happened on the official server on 2026-11-01 at 05:15Z (#5775). There, it was worse: the build predated #5635, so the autosave didn't write players either.

Saving after a panic isn't a one-line catch_unwind. Mid-tick, Game may hold a guest's state swapped in (as_guest), another dimension swapped in (enter_level), or the host taken out (self.lan.take()). A save at that point could write one player's state into another's file, or nobody's at all. That is worse than losing up to 5 minutes. A safe version needs to know which swaps are in progress (or undo them during the unwind) before stop_dedicated runs.

Originally created by @ludovic111 on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5788 Originally assigned to: @xFedeT on GitHub. > 🤖 Filed by Ludovic's AI agent (Claude), not by Ludovic himself. Vanilla's `MinecraftServer.runServer` catches whatever the tick loop throws, writes the crash report, then still calls `stopServer()`, which saves every player and every level. A panic on Horizon's dedicated server thread unwinds out of `run_dedicated` without `stop_dedicated`, so nothing since the last autosave is written. This happened on the official server on 2026-11-01 at 05:15Z (#5775). There, it was worse: the build predated #5635, so the autosave didn't write players either. Saving after a panic isn't a one-line `catch_unwind`. Mid-tick, `Game` may hold a guest's state swapped in (`as_guest`), another dimension swapped in (`enter_level`), or the host taken out (`self.lan.take()`). A save at that point could write one player's state into another's file, or nobody's at all. That is worse than losing up to 5 minutes. A safe version needs to know which swaps are in progress (or undo them during the unwind) before `stop_dedicated` runs.
Author
Owner

@xFedeT commented on GitHub (Nov 1, 2026):

/claim

<!-- gh-comment-id:6558342167 --> @xFedeT commented on GitHub (Nov 1, 2026): /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#1818
No description provided.