[PR #5129] [MERGED] horizon-server: the lists test waits for a fork-held lock descriptor to close #6094

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

📋 Pull Request Information

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

Base: main ← Head: test/lists-lock-fork-retry


📝 Commits (1)

  • fe752c7 horizon-server: the lists test waits for a fork-held lock descriptor to close

📊 Changes

2 files changed (+24 additions, -16 deletions)

View changed files

📝 crates/horizon-server/src/lists.rs (+7 -5)
📝 crates/horizon-server/src/supervisor.rs (+17 -11)

📄 Description

🤖 Opened by AurelienBelloir's AI agent (Claude Code, Claude Opus 5.5), not by AurelienBelloir personally.

What and why

lists::tests::edits_the_lists_while_stopped fails now and then on Linux CI with a server is already running in /tmp/horizon-server-lists-<pid>. That's about 4 of the last ~600 runs, two of them on main. The folder's lock is an flock taken with File::try_lock. When another test in the same binary spawns a process (tar in update.rs, id in service.rs, the engine and CLI spawns), the child holds a copy of the lock's descriptor between its fork and exec. For that moment the lock looks taken and try_lock returns WouldBlock. supervisor::tests::one_supervisor_per_folder already retried for this window (#1902, 4513af899). The lists test did not, neither for its own lock nor for the edits, which take the lock inside lists::run.

  • supervisor::retried (test-only): the existing retry, 50 tries 20 ms apart, as one helper. one_supervisor_per_folder uses it.
  • The lists test uses it for its own lock and for the edits that must succeed. The edits that must fail while the test holds the lock are unchanged, and so is lists::run in production. A retried edit changes nothing on a failed attempt: without the lock, run goes through api::Client::open, which finds no server and returns an error before anything is written.

Fixes #5127

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

None (a test of horizon-server).

Self-check

  • rustfmt ✅
  • cargo clippy -p horizon-server --all-targets -- -D warnings ✅
  • cargo test -p horizon-server --bin horizon-server -- lists:: supervisor::: 5 runs, all pass. The race needs Linux fork semantics, so CI is where the fix shows.
  • Full cargo test -p horizon-server --bin horizon-server on Windows: everything passes except service::tests::units_run_the_supervisor (Windows path separators in the launchd plist) and an occasional http::tests::a_line_past_the_limit_is_a_400. Both are unrelated to this change.
  • Public tree hook ✅

Players see no change (skip-release).

🤖 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/5129 **Author:** [@AurelienBelloir](https://github.com/AurelienBelloir) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `test/lists-lock-fork-retry` --- ### 📝 Commits (1) - [`fe752c7`](https://github.com/horizon-rust/horizon/commit/fe752c7ac583ad68f8776f606f3f0bfd27463b54) horizon-server: the lists test waits for a fork-held lock descriptor to close ### 📊 Changes **2 files changed** (+24 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-server/src/lists.rs` (+7 -5) 📝 `crates/horizon-server/src/supervisor.rs` (+17 -11) </details> ### 📄 Description > 🤖 Opened by AurelienBelloir's AI agent (Claude Code, Claude Opus 5.5), not by AurelienBelloir personally. ## What and why `lists::tests::edits_the_lists_while_stopped` fails now and then on Linux CI with `a server is already running in /tmp/horizon-server-lists-<pid>`. That's about 4 of the last ~600 runs, two of them on main. The folder's lock is an flock taken with `File::try_lock`. When another test in the same binary spawns a process (`tar` in update.rs, `id` in service.rs, the engine and CLI spawns), the child holds a copy of the lock's descriptor between its fork and exec. For that moment the lock looks taken and `try_lock` returns `WouldBlock`. `supervisor::tests::one_supervisor_per_folder` already retried for this window (#1902, 4513af899). The lists test did not, neither for its own lock nor for the edits, which take the lock inside `lists::run`. - `supervisor::retried` (test-only): the existing retry, 50 tries 20 ms apart, as one helper. `one_supervisor_per_folder` uses it. - The lists test uses it for its own lock and for the edits that must succeed. The edits that must fail while the test holds the lock are unchanged, and so is `lists::run` in production. A retried edit changes nothing on a failed attempt: without the lock, `run` goes through `api::Client::open`, which finds no server and returns an error before anything is written. Fixes #5127 ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [x] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference None (a test of horizon-server). ## Self-check - rustfmt ✅ - `cargo clippy -p horizon-server --all-targets -- -D warnings` ✅ - `cargo test -p horizon-server --bin horizon-server -- lists:: supervisor::`: 5 runs, all pass. The race needs Linux fork semantics, so CI is where the fix shows. - Full `cargo test -p horizon-server --bin horizon-server` on Windows: everything passes except `service::tests::units_run_the_supervisor` (Windows path separators in the launchd plist) and an occasional `http::tests::a_line_past_the_limit_is_a_400`. Both are unrelated to this change. - Public tree hook ✅ Players see no change (`skip-release`). 🤖 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:11:36 +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#6094
No description provided.