tools: wake-race.sh, a check for Wine's wait-on-address wake race (random crash in RtlWakeAddressSingle) #266
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem#266
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@TreXito on GitHub · 2026-12-02 22:38 UTC · original
What happens
At a random moment (three times here: under a minute, 57 minutes and 71 minutes into the world) the game dies with an access violation inside Wine's
ntdll.dll, inRtlWakeAddressSingle, reading a near-null address. The caller each time was one of our list threads (victory_gpu::list::thin::Recording::run, releasing a stdMutex), but the caller is only the victim: the queue of waiters it walks was damaged earlier by some other wake.The same damage can also show as a freeze (a thread walks the damaged queue while it holds the queue's spin lock, and every other thread spins behind it).
Neither #142 nor #184 is this one; I found no report of it here.
Cause
A Wine bug, not VIctory's. In
dlls/ntdll/sync.c,RtlWakeAddressSingle()andRtlWakeAddressAll()clearedentry->addrbeforelist_remove().RtlWaitOnAddress()looks atentry.addrwithout the lock when it wakes. A waiter that wakes on its own (timeout, or an alert left over from an earlier wake) inside that window seesNULLand returns; its stack, where the entry lies, is used again; the waker then finishes the unlink through whatever is there now.Wine fixed it in
81e52628b("ntdll: Make sure entry is removed from queue if unlocked entry.addr precheck in RtlWaitOnAddress() suggests so.", 2026-10-14): unlink first, then clearaddrwith a release store.Rust's std locks,
Condvarand thread parking all sit onWaitOnAddress/WakeByAddress*on Windows, and VIctory runs many threads on contended locks, so it triggers it well.Which runtimes have it
By the order of the stores in
RtlWakeAddressSingleof each build'sntdll.dll:env.shtakes the firstGE-Proton*it finds, and every GE build above is affected. Note that moving to another Proton can change the pipelines' fingerprint, so the firstplayafter it prepares them all again.This change
tools/wake-race.c: a stress. 24 waiters with timeouts of 10 to 70 µs and 12 wakers on four addresses; it ends with code 2 when the counters stand still for two seconds.tools/wake-race.sh [SECONDS]: builds it withx86_64-w64-mingw32-gccand runs it on the Wine and prefix thatenv.shpicks. It changes nothing in the prefix.Nothing in the game's path changes.
Tested
ntdll.dllOn the last one the game boots as before (same fingerprint, nothing to prepare again, same frame rate in the same scene). Whether the crash is gone in play needs hours of play to say; the stress result is what I can show now.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WNCfbX5dPKJzSkgbf16GX4
Pull request details or commits were not available from GitHub; kept as an issue.