[GH-ISSUE #6391] parity.py can't run a harness on Windows: fcntl, os.killpg and resource #2076

Closed
opened 2026-11-02 15:51:51 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Ragbie on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6391

Originally assigned to: @Ragbie on GitHub.

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

tools/parity.py starts on Windows since #3428, but it can't run a harness there: with the vanilla data in .local/, python tools/parity.py rule_test (and so pr_ready.py's local harness run) stops at once:

  File "tools\parity.py", line 739, in machine_slot
    import fcntl
ModuleNotFoundError: No module named 'fcntl'

Upstream main b3c2b6ddd, Windows 11, Python 3.14. The harness script itself works there: python tools/test_rule_test_parity.py passes (1,890,716 lines match on client and server, 305 s).

Three POSIX-only calls on the run path, all from #2486-era runner code:

  • machine_slot locks its slot files with fcntl.flock (also integration_env.suite_lock and test_datafix_parity.py's generate.lock);
  • a timed-out harness is killed with os.killpg, which Windows doesn't have;
  • trace_main reads the peak memory with resource.getrusage, which Windows doesn't have.

Fix: lock with msvcrt.locking on Windows, kill a timed-out harness's process tree with taskkill /T /F, and leave peak_bytes out of the trace where resource is missing (the scheduler then assumes DEFAULT_MEMORY, as for a harness that never ran).

Originally created by @Ragbie on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6391 Originally assigned to: @Ragbie on GitHub. > 🤖 Filed by Ragbie's AI agent (Claude Code, Opus 5.5), not by Ragbie personally. `tools/parity.py` starts on Windows since #3428, but it can't run a harness there: with the vanilla data in `.local/`, `python tools/parity.py rule_test` (and so `pr_ready.py`'s local harness run) stops at once: ``` File "tools\parity.py", line 739, in machine_slot import fcntl ModuleNotFoundError: No module named 'fcntl' ``` Upstream `main` `b3c2b6ddd`, Windows 11, Python 3.14. The harness script itself works there: `python tools/test_rule_test_parity.py` passes (1,890,716 lines match on client and server, 305 s). Three POSIX-only calls on the run path, all from #2486-era runner code: - `machine_slot` locks its slot files with `fcntl.flock` (also `integration_env.suite_lock` and `test_datafix_parity.py`'s `generate.lock`); - a timed-out harness is killed with `os.killpg`, which Windows doesn't have; - `trace_main` reads the peak memory with `resource.getrusage`, which Windows doesn't have. Fix: lock with `msvcrt.locking` on Windows, kill a timed-out harness's process tree with `taskkill /T /F`, and leave `peak_bytes` out of the trace where `resource` is missing (the scheduler then assumes `DEFAULT_MEMORY`, as for a harness that never ran).
Author
Owner

@Ragbie commented on GitHub (Nov 1, 2026):

/claim

<!-- gh-comment-id:6563242997 --> @Ragbie commented on GitHub (Nov 1, 2026): /claim
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#2076
No description provided.