[PR #2982] [MERGED] Server core: keep-alive timeout, pause grace, watchdog and function permission like vanilla #4734

Closed
opened 2026-11-03 05:07:32 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2982
Author: @kacpherek
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix/server-core-parity


📝 Commits (6)

  • 052dac8 Drop a guest that misses a keep-alive for 15 seconds
  • 02b1d1f Pause on lost focus only after 500 ms without it
  • a0b19a4 Stop a dedicated server whose tick runs past max-tick-time
  • fece4c6 Run function commands at function-permission-level
  • b85a9e8 Merge main into fix/server-core-parity
  • 8ce20ba Merge main into this branch

📊 Changes

5 files changed (+168 additions, -18 deletions)

View changed files

📝 crates/horizon-client-render/src/crash.rs (+19 -0)
📝 crates/horizon-client/src/game.rs (+26 -13)
📝 crates/horizon-client/src/game/dedicated.rs (+102 -1)
📝 crates/horizon-client/src/game/functions.rs (+14 -0)
📝 crates/horizon-client/src/lan/conn.rs (+7 -4)

📄 Description

What and why

  • A guest that does not answer a keep-alive within 15 s is disconnected with "Timed out". Horizon waited 30 s; 30 s is only the connection read timeout.
  • The game pauses on lost focus only after the window has been without focus for more than 500 ms. A brief focus steal (a notification, a quick alt-tab back) no longer opens the pause menu.
  • A dedicated server with max-tick-time above 0 (default 60000) now has a watchdog. When a tick runs that far past its due time it logs the fatal lines, writes a crash report and exits with status 1. The option was read and never used.
  • Function files run their commands at function-permission-level (2 in single player and LAN, the property on a dedicated server), whoever runs them. Before, they used the caller's level: tick, load and scheduled functions did nothing in a world without cheats, and an owner's function could run commands above the function level.

Vanilla reference

  • ServerCommonPacketListenerImpl.java:152-166 (keepConnectionAlive, 15000 ms and the pending flag); ServerConnectionListener.java:46,77 (read timeout 30 s)
  • Minecraft.java:1397-1404 (pauseIfInactive, 500 ms)
  • DedicatedServer.java:268 (watchdog thread, started when the max tick length is above 0); ServerWatchdog.java:36-80 (run)
  • ServerFunctionLibrary.java:84 and CommandFunction.java:102-104 and MacroFunction.java:140 (every line compiles with the library's permission); DedicatedServerProperties.java:93 (function-permission-level, default 2)

Not changed

  • The watchdog's crash report has no thread dump: Rust cannot read another thread's stack.
  • A function line above the function level fails when the line runs, not when the function loads, so the rest of the function still runs. Vanilla drops the whole function at load.

Self-check

clippy and fmt pass for horizon-client. Not run in game.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/2982 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/server-core-parity` --- ### 📝 Commits (6) - [`052dac8`](https://github.com/horizon-rust/horizon/commit/052dac817a5db2ee442a7b7353a04983c0347f6c) Drop a guest that misses a keep-alive for 15 seconds - [`02b1d1f`](https://github.com/horizon-rust/horizon/commit/02b1d1f430a189910080ad98d1c3afd6ae06a083) Pause on lost focus only after 500 ms without it - [`a0b19a4`](https://github.com/horizon-rust/horizon/commit/a0b19a4820263a65ce675eb610d9c3be89d8ae01) Stop a dedicated server whose tick runs past max-tick-time - [`fece4c6`](https://github.com/horizon-rust/horizon/commit/fece4c6a76d45fe36b2c4b1d6bbded681838d989) Run function commands at function-permission-level - [`b85a9e8`](https://github.com/horizon-rust/horizon/commit/b85a9e83508db64d2364aa0101977257e70990a4) Merge main into fix/server-core-parity - [`8ce20ba`](https://github.com/horizon-rust/horizon/commit/8ce20ba5bdda3fa24ca2f1d5e71e9e64ad23f76a) Merge main into this branch ### 📊 Changes **5 files changed** (+168 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/crash.rs` (+19 -0) 📝 `crates/horizon-client/src/game.rs` (+26 -13) 📝 `crates/horizon-client/src/game/dedicated.rs` (+102 -1) 📝 `crates/horizon-client/src/game/functions.rs` (+14 -0) 📝 `crates/horizon-client/src/lan/conn.rs` (+7 -4) </details> ### 📄 Description ## What and why - A guest that does not answer a keep-alive within 15 s is disconnected with "Timed out". Horizon waited 30 s; 30 s is only the connection read timeout. - The game pauses on lost focus only after the window has been without focus for more than 500 ms. A brief focus steal (a notification, a quick alt-tab back) no longer opens the pause menu. - A dedicated server with `max-tick-time` above 0 (default 60000) now has a watchdog. When a tick runs that far past its due time it logs the fatal lines, writes a crash report and exits with status 1. The option was read and never used. - Function files run their commands at `function-permission-level` (2 in single player and LAN, the property on a dedicated server), whoever runs them. Before, they used the caller's level: tick, load and scheduled functions did nothing in a world without cheats, and an owner's function could run commands above the function level. ## Vanilla reference - ServerCommonPacketListenerImpl.java:152-166 (keepConnectionAlive, 15000 ms and the pending flag); ServerConnectionListener.java:46,77 (read timeout 30 s) - Minecraft.java:1397-1404 (pauseIfInactive, 500 ms) - DedicatedServer.java:268 (watchdog thread, started when the max tick length is above 0); ServerWatchdog.java:36-80 (run) - ServerFunctionLibrary.java:84 and CommandFunction.java:102-104 and MacroFunction.java:140 (every line compiles with the library's permission); DedicatedServerProperties.java:93 (function-permission-level, default 2) ## Not changed - The watchdog's crash report has no thread dump: Rust cannot read another thread's stack. - A function line above the function level fails when the line runs, not when the function loads, so the rest of the function still runs. Vanilla drops the whole function at load. ## Self-check clippy and fmt pass for horizon-client. Not run in game. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:32 +07:00
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#4734
No description provided.