[PR #6851] [MERGED] Tell a busy server thread from a stopped one #7143

Closed
opened 2026-11-03 06:34:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6851
Author: @ludovic111
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: perf/entities-summon-stall


📝 Commits (1)

  • 5b0fd8d Tell a busy server thread from a stopped one

📊 Changes

5 files changed (+37 additions, -14 deletions)

View changed files

📝 crates/horizon-client/src/game/agent.rs (+1 -1)
📝 crates/horizon-client/src/game/blockctl.rs (+1 -1)
📝 crates/horizon-client/src/game/control.rs (+7 -7)
📝 crates/horizon-client/src/game/integrated.rs (+26 -3)
📝 crates/horizon-client/src/game/lan.rs (+2 -2)

📄 Description

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

What

IntegratedServer::call waits 10 s for the server thread's answer. A stopped server and a slow one both produced "the integrated server stopped". One perf_bench --scenes stress run (#6808) failed with that message in the middle of the 2000 summon item commands, and nothing could tell a stall from a stop.

  • On a timeout, call now logs a warning with the server's state: whether its thread still runs, whether it is autosaving, and its smoothed tick time.
  • The callers' error now says "the integrated server stopped or did not answer within 10 s (the game log says which)". The callers are horizon-ctl commands, lan status, Open to LAN and block commands.
  • A real stop while the server starts keeps its own message.

Players' own commands don't go through call: they travel over the memory connection, with no timeout. So a player summoning many entities sees lag at worst, never this error. When the error does happen, only that one request fails, and the game keeps running.

Trying to reproduce

Mac mini M4 Pro, current main (a7df9ec019). I ran the same scenes as the failing run, three times: stress_empty, stress_mobs, then stress_items, with perf_bench's repeats. A driver timed every control call and ran sample on the game whenever a call took longer than 3 s. Run 3 also had HORIZON_SPIKES=1000, which logs every server tick over 1 s.

Run Commands Slowest p99 Server ticks over 1 s
1 9108 0.319 s 0.071 s (not logged)
2 9108 0.244 s 0.064 s (not logged)
3 9108 0.255 s 0.060 s 0

There was no stall. The slowest answer is about 30 times under the 10 s limit. The failing run used an older build (0454e97e32 plus GPU posing) on a machine under heavy load, with a nearly full disk at times. The autosave writes level.dat, maps, stats and advancements synchronously on the server thread, which fits a slow disk better than CPU load. The new warning will show it (autosaving: true) if it happens again.

Checks

cargo fmt --all -- --check                                              ok
cargo clippy --profile fast -p horizon-client --lib --bins -- -D warnings   ok, 0 diagnostics

No test: the change only adds a log line and a message; None on a timeout is unchanged.

🤖 Generated with Claude Code


🔄 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/6851 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/entities-summon-stall` --- ### 📝 Commits (1) - [`5b0fd8d`](https://github.com/horizon-rust/horizon/commit/5b0fd8d4f551249f5d405c3b3f8e13f7e52748f7) Tell a busy server thread from a stopped one ### 📊 Changes **5 files changed** (+37 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/agent.rs` (+1 -1) 📝 `crates/horizon-client/src/game/blockctl.rs` (+1 -1) 📝 `crates/horizon-client/src/game/control.rs` (+7 -7) 📝 `crates/horizon-client/src/game/integrated.rs` (+26 -3) 📝 `crates/horizon-client/src/game/lan.rs` (+2 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What `IntegratedServer::call` waits 10 s for the server thread's answer. A stopped server and a slow one both produced "the integrated server stopped". One `perf_bench --scenes stress` run (#6808) failed with that message in the middle of the 2000 `summon item` commands, and nothing could tell a stall from a stop. - **On a timeout,** `call` now logs a warning with the server's state: whether its thread still runs, whether it is autosaving, and its smoothed tick time. - **The callers' error** now says "the integrated server stopped or did not answer within 10 s (the game log says which)". The callers are horizon-ctl commands, `lan status`, Open to LAN and block commands. - **A real stop** while the server starts keeps its own message. Players' own commands don't go through `call`: they travel over the memory connection, with no timeout. So a player summoning many entities sees lag at worst, never this error. When the error does happen, only that one request fails, and the game keeps running. ## Trying to reproduce Mac mini M4 Pro, current main (a7df9ec019). I ran the same scenes as the failing run, three times: `stress_empty`, `stress_mobs`, then `stress_items`, with perf_bench's repeats. A driver timed every control call and ran `sample` on the game whenever a call took longer than 3 s. Run 3 also had `HORIZON_SPIKES=1000`, which logs every server tick over 1 s. | Run | Commands | Slowest | p99 | Server ticks over 1 s | |---|---|---|---|---| | 1 | 9108 | 0.319 s | 0.071 s | (not logged) | | 2 | 9108 | 0.244 s | 0.064 s | (not logged) | | 3 | 9108 | 0.255 s | 0.060 s | 0 | There was no stall. The slowest answer is about 30 times under the 10 s limit. The failing run used an older build (0454e97e32 plus GPU posing) on a machine under heavy load, with a nearly full disk at times. The autosave writes level.dat, maps, stats and advancements synchronously on the server thread, which fits a slow disk better than CPU load. The new warning will show it (autosaving: true) if it happens again. ## Checks ``` cargo fmt --all -- --check ok cargo clippy --profile fast -p horizon-client --lib --bins -- -D warnings ok, 0 diagnostics ``` No test: the change only adds a log line and a message; `None` on a timeout is unchanged. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:34:38 +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#7143
No description provided.