[PR #1182] [MERGED] online_mode harness: one login at a time, and vanilla's two log races #3397

Closed
opened 2026-11-03 04:09:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1182
Author: @ludovic111
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @ludovic111

Base: main ← Head: fix/online-mode-log-order


📝 Commits (1)

  • 6f1f83d online_mode harness: one login at a time, and vanilla's two log races

📊 Changes

1 file changed (+44 additions, -13 deletions)

View changed files

📝 tools/test_online_mode_parity.py (+44 -13)

📄 Description

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

What. tools/test_online_mode_parity.py compared the servers' lines about the player in the order the server printed them, and that order has three races in it. Under load the harness failed now and then with a line moved or a different reason (flake 4 of the flakes-1 brief).

Why, and how it's fixed (only the harness changes, nothing Horizon runs):

  1. Logins overlapped. A login's lost connection is logged at the server's next tick, and the next client run could start before that. login() now waits for that login's lost connection: line before the next one starts.
  2. Two threads. Vanilla's authenticator disconnects a player and then logs why (ServerLoginPacketListenerImpl), while the server thread may already have logged the lost connection. Each login's lines are now compared thread by thread, and each thread keeps its own order.
  3. Kick reason. A kicked client closes its connection once it reads why. When that happens first, vanilla logs the lost connection as Disconnected instead of the kick's reason. This showed up once in 12 runs on the desktop: -lost connection: Disconnected / +lost connection: You are not white-listed on this server!, and that time the Disconnected was vanilla's. Within one login that has a Disconnecting ...: <reason> line, lost connection: Disconnected now counts as that reason.

The checks themselves are unchanged. Every line is still compared, and so is the order within each thread and between logins.

How tested. On the desktop under heavy load (load 30-45 on 24 threads: other agents' builds plus my other proofs):

python3 tools/parity.py online_mode --repeat 15 --fresh -j 4 --hosts ""
15 PASS, 0 FAIL   (1 passed, 0 failed in 28.2 min)

Before the third change the same run gave 11 PASS and 1 FAIL (the kick-reason race above). Before any change the line order could flip as described.

Needs Ludovic: nothing.

🤖 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/1182 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/online-mode-log-order` --- ### 📝 Commits (1) - [`6f1f83d`](https://github.com/horizon-rust/horizon/commit/6f1f83d07c25006ff3fad42a526abcfe36f3a441) online_mode harness: one login at a time, and vanilla's two log races ### 📊 Changes **1 file changed** (+44 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `tools/test_online_mode_parity.py` (+44 -13) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **What.** `tools/test_online_mode_parity.py` compared the servers' lines about the player in the order the server printed them, and that order has three races in it. Under load the harness failed now and then with a line moved or a different reason (flake 4 of the flakes-1 brief). **Why, and how it's fixed** (only the harness changes, nothing Horizon runs): 1. **Logins overlapped.** A login's `lost connection` is logged at the server's next tick, and the next client run could start before that. `login()` now waits for that login's `lost connection: ` line before the next one starts. 2. **Two threads.** Vanilla's authenticator disconnects a player and *then* logs why (`ServerLoginPacketListenerImpl`), while the server thread may already have logged the lost connection. Each login's lines are now compared thread by thread, and each thread keeps its own order. 3. **Kick reason.** A kicked client closes its connection once it reads why. When that happens first, vanilla logs the lost connection as `Disconnected` instead of the kick's reason. This showed up once in 12 runs on the desktop: `-lost connection: Disconnected` / `+lost connection: You are not white-listed on this server!`, and that time the `Disconnected` was vanilla's. Within one login that has a `Disconnecting ...: <reason>` line, `lost connection: Disconnected` now counts as that reason. The checks themselves are unchanged. Every line is still compared, and so is the order within each thread and between logins. **How tested.** On the desktop under heavy load (load 30-45 on 24 threads: other agents' builds plus my other proofs): ``` python3 tools/parity.py online_mode --repeat 15 --fresh -j 4 --hosts "" 15 PASS, 0 FAIL (1 passed, 0 failed in 28.2 min) ``` Before the third change the same run gave 11 PASS and 1 FAIL (the kick-reason race above). Before any change the line order could flip as described. **Needs Ludovic:** nothing. 🤖 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 04:09:14 +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#3397
No description provided.