Keep Wine runner resources scoped to one prefix owner #1964

Merged
leonida/mandy
lgr123 merged 1 commit from lgr123/wine-prefix-ownership into main 2026-11-28 14:49:50 +00:00

Pull request successfully merged and closed

lgr123 commented 2026-11-25 16:53:34 +00:00

Claimed in the coordination issue as WINE-PREFIX-RUNNER-OWNERSHIP.

What and why

Two direct invocations of the Wine runner can share a temporary mapping in the same prefix. On main, two independent processes both read a synthetic fixture through D:. The first passed and removed its link on exit. The second then failed because the link was gone. Separately, an owner stopping its kept wineserver can interrupt a borrower.

On POSIX, hold an exclusive nonblocking lock on the Wine prefix directory from before mapping or server setup through teardown. A simultaneous invocation gets a usage error. A symlink to the same prefix shares the lock. Distinct prefixes can still run in parallel, --jobs within a run is unchanged, and the lock leaves no file behind. The runner creates an empty prefix directory if it needs one for the lock. This scopes ownership among direct runner invocations. The session wrapper continues to call for its own dedicated test prefix.

Tested

  • Linux x86-64, Python 3.11.17 in Docker. The standalone reproduction failed on public main 9e7720c9 and passed after the change. The new integration regression failed on main, then confirmed that the symlink alias was rejected, a separate prefix could run, and the original prefix could be reused after teardown.
  • All 73 runner tests and all 6 fixture tests passed with disposable prefixes. Tests substitute Python children or synthetic wineserver processes. No real Wine execution or game files were needed.
  • git diff --check and the source-only policy check passed.

GPUs tested: n/a.

AI-assisted: yes.

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys or decryption.
Claimed in the coordination issue as [WINE-PREFIX-RUNNER-OWNERSHIP](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7168516497). ### What and why Two direct invocations of the Wine runner can share a temporary mapping in the same prefix. On main, two independent processes both read a synthetic fixture through D:. The first passed and removed its link on exit. The second then failed because the link was gone. Separately, an owner stopping its kept wineserver can interrupt a borrower. On POSIX, hold an exclusive nonblocking lock on the Wine prefix directory from before mapping or server setup through teardown. A simultaneous invocation gets a usage error. A symlink to the same prefix shares the lock. Distinct prefixes can still run in parallel, --jobs within a run is unchanged, and the lock leaves no file behind. The runner creates an empty prefix directory if it needs one for the lock. This scopes ownership among direct runner invocations. The session wrapper continues to call for its own dedicated test prefix. ### Tested - Linux x86-64, Python 3.11.17 in Docker. The standalone reproduction failed on public main 9e7720c9 and passed after the change. The new integration regression failed on main, then confirmed that the symlink alias was rejected, a separate prefix could run, and the original prefix could be reused after teardown. - All 73 runner tests and all 6 fixture tests passed with disposable prefixes. Tests substitute Python children or synthetic wineserver processes. No real Wine execution or game files were needed. - git diff --check and the source-only policy check passed. GPUs tested: n/a. AI-assisted: yes. ### Checklist - [x] Based on current main. - [x] One topic. - [x] No game data, keys or decryption.
MoonEyes commented 2026-11-28 14:49:48 +00:00

Red/green: test_run_wine_tests.py failed one assertion on main because a second runner could reuse the same Wine prefix, and passes with the flock that makes it exit with rc 2.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main 4f9199d09 in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

Red/green: test_run_wine_tests.py failed one assertion on main because a second runner could reuse the same Wine prefix, and passes with the flock that makes it exit with rc 2. Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main 4f9199d09 in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No description provided.