[pr-fix][linux-proton] Crash records from two threads stay whole under Wine #355

Manually merged
TrustNo1 merged 1 commit from ntsthay/wine-crash-append into main 2026-12-05 04:49:40 +00:00 AGit
Contributor

Not run in the game. A unit test shows the problem under Wine when the machine is busy.

Contributor role (optional)

  • Fluxer ID:

What it changes

append_record writes a crash record with one append, so records from two threads that crash at the same time stay whole. Under Wine they can interleave. On f3840d7, concurrent_crash_records_stay_together passes alone but fails when other tests run beside it: with cargo nextest run -p darner-hle -p darner-loader --stress-count 5 under Proton, it failed in all 5 iterations with assertion failed: lines.next().is_some_and(|line| line == body).

Under Wine only, the record's file is now locked for the write. The handler takes the lock with File::try_lock and yields between tries, so it never blocks for good. After 10,000 tries it writes anyway, since a thread that crashed while holding the lock lets it go only when its handle closes. On Windows nothing changes.

How it was tested

  • Tested revision: b7767d1, this branch on f3840d7.
  • Commands and results: the same --stress-count 5 run under Proton (proton-cachyos, RTX 4080, 32 threads): concurrent_crash_records_stay_together failed 0 times in 5 iterations, against 5 of 5 on f3840d7. The 23 crash:: tests pass.
  • Gates 1 and 2 are clean. Gate 3 ran under Wine, not on Windows.
  • Gameplay: not run.
  • Coverage gaps: no run on Windows; no game run with two threads crashing at once.

Checklist

  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #173 counts crash records in a benchmark script, a different change.
Not run in the game. A unit test shows the problem under Wine when the machine is busy. ## Contributor role (optional) - Fluxer ID: ## What it changes `append_record` writes a crash record with one append, so records from two threads that crash at the same time stay whole. Under Wine they can interleave. On `f3840d7`, `concurrent_crash_records_stay_together` passes alone but fails when other tests run beside it: with `cargo nextest run -p darner-hle -p darner-loader --stress-count 5` under Proton, it failed in all 5 iterations with `assertion failed: lines.next().is_some_and(|line| line == body)`. Under Wine only, the record's file is now locked for the write. The handler takes the lock with `File::try_lock` and yields between tries, so it never blocks for good. After 10,000 tries it writes anyway, since a thread that crashed while holding the lock lets it go only when its handle closes. On Windows nothing changes. ## How it was tested - Tested revision: `b7767d1`, this branch on `f3840d7`. - Commands and results: the same `--stress-count 5` run under Proton (proton-cachyos, RTX 4080, 32 threads): `concurrent_crash_records_stay_together` failed 0 times in 5 iterations, against 5 of 5 on `f3840d7`. The 23 `crash::` tests pass. - Gates 1 and 2 are clean. Gate 3 ran under Wine, not on Windows. - Gameplay: not run. - Coverage gaps: no run on Windows; no game run with two threads crashing at once. ## Checklist - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #173 counts crash records in a benchmark script, a different change.
TrustNo1 manually merged commit ee00dcc736 into main 2026-12-05 04:49:40 +00:00
Sign in to join this conversation.
No reviewers
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
TrustNo1/Darner!355
No description provided.