Keep Wine runner resources scoped to one prefix owner #1964

Merged
lgr123 merged 1 commit from upstream-pr/1964 into main 2026-11-28 14:49:50 +00:00
lgr123 commented 2026-11-25 16:53:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lgr123 on 2026-11-25T16:53:34Z.


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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5495502651 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1964). Originally posted by [lgr123](https://github.com/lgr123) on 2026-11-25T16:53:34Z. --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T14:49:48Z.


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)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7240963419 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1964#issuecomment-7240963419). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T14:49:48Z. --- 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 reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1964
No description provided.