[PR #5923] [MERGED] Official server: joins no longer reset when the connection cap fills #6562

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

📋 Pull Request Information

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

Base: main ← Head: fix/connection-cap-per-address


📝 Commits (5)

  • 21b8af4 Server: one address takes at most 10 connection places; the login waits 10 s
  • ea9b10f lan: a full server closes the connection that waited longest
  • 2124982 lan: sort the turned-away addresses by key (clippy)
  • dd4b209 lan: don't make room while holding the address map
  • 98e49e3 lan: make room in the test with a log writer set

📊 Changes

2 files changed (+285 additions, -14 deletions)

View changed files

📝 crates/horizon-client/src/lan/conn.rs (+10 -3)
📝 crates/horizon-client/src/lan/mod.rs (+275 -11)

📄 Description

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

Fixes #5901. Since 09:00Z, joining the official server fails about 95% of the time with os error 10054. The connection cap from #5776 (max players + 64 spare) fills with connections that never reach the game, and every socket past the cap is dropped.

  • At most 10 connections per address: one address can't take every place. Loopback, private and link-local addresses are exempt (LAN, proxies, containers).
  • A 10 s limit for handshake, status and login (it was 30 s, the read timeout of play). Configuration and play keep 30 s.
  • A full server makes room: it closes the connection that has waited longest (more than 2 s) before play (handshake, status, login, configuration, admission) and admits the new one. A login or a server-list ping takes a fraction of that. Players in the game are never closed.
    make_room logs, and the log reads the address map: count releases that lock first. The first deploy (ea9b10f, 11:52Z) held it, and the accept loop deadlocked when the server filled at 11:59Z. The test now runs with a log writer, and it hangs without the fix.
  • A log line every 60 s while connections are turned away: places taken, number of addresses, the five busiest ones (withheld when log-ips is off).

Per-connection cost: one map update, plus one try_clone and one list push at accept. Nothing changes per packet or per tick.

Tests: one_address_takes_at_most_its_share, a_full_server_closes_the_connection_that_waited_longest; the loopback flood test still passes.

Live since 12:22Z (dd4b209 = this head minus the test commit): status pings ok every minute, 99 joins in 15 min. The cap stays full (133 of 133, about 65 addresses, 37 players online), and make_room keeps players getting in. Why so many places are held is followed up in a stacked PR (write timeout).

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 9543d2a68, 6 min 46 s)

Check Result
Scope ✅ 2 files, +285 −14
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 515 passed (1 min 27 s)
rustfmt ✅ (19 s)
clippy ✅ (42 s)
tests: horizon-client ✅ 1680 passed (3 min 43 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 36 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, lan and 24 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/5923 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/connection-cap-per-address` --- ### 📝 Commits (5) - [`21b8af4`](https://github.com/horizon-rust/horizon/commit/21b8af4bf3d409b84292931f88c6eda359f353c3) Server: one address takes at most 10 connection places; the login waits 10 s - [`ea9b10f`](https://github.com/horizon-rust/horizon/commit/ea9b10f290ca2fa7fc24e382746527f21eeeaaf9) lan: a full server closes the connection that waited longest - [`2124982`](https://github.com/horizon-rust/horizon/commit/21249821f20cefb0e7cdff8c1ff5ff829155f1be) lan: sort the turned-away addresses by key (clippy) - [`dd4b209`](https://github.com/horizon-rust/horizon/commit/dd4b209ae7c02df2fa17fa67f4f28ba543b7883a) lan: don't make room while holding the address map - [`98e49e3`](https://github.com/horizon-rust/horizon/commit/98e49e36c87c9fcf9c29dba63e663348cdf47190) lan: make room in the test with a log writer set ### 📊 Changes **2 files changed** (+285 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/lan/conn.rs` (+10 -3) 📝 `crates/horizon-client/src/lan/mod.rs` (+275 -11) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #5901. Since 09:00Z, joining the official server fails about 95% of the time with `os error 10054`. The connection cap from #5776 (max players + 64 spare) fills with connections that never reach the game, and every socket past the cap is dropped. - **At most 10 connections per address**: one address can't take every place. Loopback, private and link-local addresses are exempt (LAN, proxies, containers). - **A 10 s limit for handshake, status and login** (it was 30 s, the read timeout of play). Configuration and play keep 30 s. - **A full server makes room**: it closes the connection that has waited longest (more than 2 s) before play (handshake, status, login, configuration, admission) and admits the new one. A login or a server-list ping takes a fraction of that. Players in the game are never closed. `make_room` logs, and the log reads the address map: `count` releases that lock first. The first deploy (ea9b10f, 11:52Z) held it, and the accept loop deadlocked when the server filled at 11:59Z. The test now runs with a log writer, and it hangs without the fix. - **A log line every 60 s** while connections are turned away: places taken, number of addresses, the five busiest ones (withheld when `log-ips` is off). Per-connection cost: one map update, plus one `try_clone` and one list push at accept. Nothing changes per packet or per tick. Tests: `one_address_takes_at_most_its_share`, `a_full_server_closes_the_connection_that_waited_longest`; the loopback flood test still passes. Live since 12:22Z (dd4b209 = this head minus the test commit): status pings ok every minute, 99 joins in 15 min. The cap stays full (133 of 133, about 65 addresses, 37 players online), and make_room keeps players getting in. Why so many places are held is followed up in a stacked PR (write timeout). **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 9543d2a68, 6 min 46 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +285 −14 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 515 passed (1 min 27 s) | | rustfmt | ✅ (19 s) | | clippy | ✅ (42 s) | | tests: horizon-client | ✅ 1680 passed (3 min 43 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 36 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, lan and 24 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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:23:07 +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#6562
No description provided.