Wine: the world stops ~3 min in while Wine reports RtlReleaseSRWLockExclusive on a lock that is not held (x231, three threads) #774
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#774
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?
@MrCloudy2 on GitHub · 2026-11-24 10:14 UTC · original
An observation from Linux/Wine. I'm filing it because I found no issue or PR that mentions it. It is one run so far, and I have not shown that the lock is what stops the title, so read it as a lead.
Setup
WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11,d3d10core,d3d9=n". vkd3d-proton 3.2.0 (from Proton Experimental), DXVK dxgi.main8e79c80+ #151 #190 #454 #493 #579 + #177's key fix, cross-compiled with xwin. Own 1.0.2.1 copy.VICTORY_NO_WATCHDOG=1,VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains, network off.WINEDEBUG=err+vulkan,err+seh. The defaulterrchannel would show the same lines; they were hidden in my earlier runs only because I ran with-all.What happened
story000*archives. World audio plays, and the screen stays mostly black, as expected on this host.01ec,0224,021c), on one lock address: The first one comes right after a batch ofshader does not translatewarnings and vkd3d-proton's "application has stopped creating new PSOs" disk-cache flush.crashes.logentry, and no device removal, until killed.Why it may matter
Wine checks this case and Windows does not.
ReleaseSRWLockExclusiveon a lock that is free or held shared silently corrupts the lock state on Windows, while Wine prints the error. VIctory has no SRW-lock code of its own (grep -ri srwlock cratesfinds nothing), so the caller is the title through its kernel32 imports, or vkd3d-proton, DXVK or the driver underneath. A lock released by someone who doesn't hold it, by three threads, could be what deadlocks the title's threads here. The world hangs reported on Windows (#71, #325, #619, #625) end with the host GPU hung. This one ends with no GPU error.Not done yet
+relay/backtrace onRtlReleaseSRWLockExclusive, orVICTORY_STACKSat the moment of the first message.AI-assisted (Claude Code); run and observed on the machine above.
@MrCloudy2 on GitHub · 2026-11-24 10:21 UTC · original
Second run, same machine and logging (
WINEDEBUG=err+vulkan,err+seh,err+sync). The build differs: it also has the wave64 stack (#223 → #233 → #320 → #439).RtlReleaseSRWLockExclusive ... not owned exclusivemessages this time (0, against 231 in the first run).So the lock messages are not required for this stall. The stall looks like the very low world frame rate others report (e.g. 0.2–1 fps in #752) rather than a deadlock. The lock misuse is still real in the first run, but I can't tie it to the stall. I'll leave this open as a Wine-specific observation in case someone sees the messages again; close it if that's not useful.
@DaviTostes on GitHub · 2026-11-24 11:27 UTC · original
Another data point, on RDNA4 + Wine 11.22, so it is not specific to your NVIDIA/CachyOS run and not fixed by vkd3d 3.2:
mainffe310e, release MSVC build (cargo xwin), package 1.0.2.1,build unknown (b99f876b…b5c35a79d5decd9f716504239e93).dxgi, vkd3d-proton 3.2.0 (Proton Experimental DLLs),WINEDLLOVERRIDES="d3d12,d3d12core,dxgi=n",VICTORY_KEYS=….Observed: 211
err:sync:RtlReleaseSRWLockExclusive Lock 0000001ECE4B84A0 is not owned exclusive!lines starting ~3 minutes into the world (another run used lock00000061744B84A0), from four threads (01dc,01d8,01e0,01e8), right after a batch ofshader does not translatewarnings.Two outcomes in different runs:
host GPU device removed … 0x887A0005after a 7-list submission (the #714 signature);crashes.logentry in either.So the lock warning does not by itself stop our frame-progress lines, but the run that ended in device removal had it. The caller remains unnamed — I did not run
+relayor a stacks build.Not tested:
+relay/VICTORY_STACKSaround the first message, a Windows comparison, and the #454/#493/#579 stack.@Mumogg on GitHub · 2026-11-24 15:08 UTC · original
Two findings for this issue, from an RTX 5070 Ti under Wine: who releases the lock, and what the process is doing when the frames stop. They turn out to be separate things.
Setup: RTX 5070 Ti, driver 615.78.08, Nobara 44, Wine 11.21 Staging, vkd3d-proton and DXVK
dxgi.dllfrom GE-Proton11-14. Diag build offfe310e+ #454 #177 #259 #233 #646 #578 + #334 #493 #724 #725 + the #783 fallback + #909.VICTORY_NO_WATCHDOG=1,VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains.1. The lock is vkd3d-proton's, and it is released twice by one function
WINEDEBUG=+relaywithRelayIncludeset to thentdll.Rtl*SRWLock*entry points gives the return address of every call. Kept only for the lock named in the error (it ends in…F84B0here in every run), one run into the world:RtlAcquireSRWLockExclusived3d12core.dll+0x4a3bc8RtlReleaseSRWLockExclusived3d12core.dll+0x4a3cf4RtlReleaseSRWLockExclusived3d12core.dll+0x4a3c55err:sync:RtlReleaseSRWLockExclusive … is not owned exclusive!Every error follows the same three calls on one thread: acquire at
+0x4a3bc8, release at+0x4a3c55, release at+0x4a3cf4. The title is not involved (no call on that lock comes from the title's image), and neither is VIctory.The strings next to that code name the function:
vkd3d_try_allocate_device_memory(libs/vkd3d/memory.c), and the lock ismemory_info->budget_lock. The path is still in upstreammasteras I read it today: inside the candidate loop, when the fixed ReBAR budget would be exceeded the lock is released and the loopcontinues (a failedvkAllocateMemoryreleases it too); if that was the last candidate, the loop ends withrebar_budgetstill true, and the block after the loop skips its ownpthread_mutex_lock(it assumes the lock is still held whenrebar_budget && respect_budget) and callspthread_mutex_unlockagain. So each allocation refused for the ReBAR budget releases the lock twice. Wine reports it; on Windows the second release goes unreported.That makes the message a symptom of those refused allocations rather than of a title lock. Its start "right after a batch of shader warnings" fits a point where the host starts allocating a lot. I have not reported it to vkd3d-proton.
2. When the frames stop, one title thread is spinning and nothing is inside VIctory
The stop is intermittent here: about half of the 6 to 8 min runs, 3 to 5 min after launch, with no Xid in the kernel log and no device removal. With
VICTORY_STACKSevery 40 s, one run that stopped at 231 s has four dumps taken after the stop:victory_gpuor any other VIctory code except idle waits (DirectStorage workers, pipeline workers, the decoder).ntdllsystem calls (waits), the same in both dumps.title+0x50eb81f, called from+0x31962<+0x317fd<+0x25d801b< the job loop at+0x221c29c. Before the stop that thread was idle in the job loop like the others.From its code that place is a lookup in an open-addressing table that compares a group of tags and, on no match, steps to the next group with no test for an empty slot, so it never ends for a key that is not in the table. I have not found which key or table it is, or why the key is missing; a registration that did not happen (a load that failed or came late) would do it. Nothing here shows the lock of point 1 is related: the double release happens over a thousand times in runs that do not stop as well.
So on this machine the "world stops, process stays alive" case is the title waiting on a worker that will not return, not a host lock.
Not tested: Windows, AMD, whether the same thread and place show in other people's stops (a
VICTORY_STACKSdump after the stop would tell), more than one stopped run with dumps.AI-assisted (Claude Code): it set up the relay trace, symbolized and compared the dumps and wrote this comment. No game data attached.
@crashbashash on GitHub · 2026-11-24 13:37 UTC · original · edited 2026-11-24 15:13 UTC
A data point the other way round from your second run: the lock messages without the stop.
Setup: CachyOS (kernel 7.3.4), RX 6800 XT (RDNA2, RADV, Mesa 26.2.6), GE-Proton11-14 (vkd3d-proton
cae8353ed) run withproton runinprefix, #844 atb7cc788, diagnostics build via cargo-xwin, 1.0.2.1, watchdog not disabled.RtlReleaseSRWLockExclusive Lock … is not owned exclusive!came ~2 min 18 s into the world, close to your first run's ~3 min: 200 in total, from two threads, all on one lock address.With your second run (the stop without the messages), that suggests the messages and the stop are independent.
My run did end about 8 minutes later, but not with your stop: several worker threads hit a title assert (
int3at+0x5149aec, a null storage pointer in a pool accessor) about 16 s after a 31 s frame. Not the watchdog sites from #454 either.No game data used. AI-assisted (Claude Code).
Edited: the durations above were first timed from the start of the story load; they are now from entering the world (the load took 29–41 s). The conclusions don't change.
@Mumogg on GitHub · 2026-11-24 17:30 UTC · original · edited 2026-11-24 19:08 UTC
Follow-up on the stop (part 2 of my earlier comment): two more freezes caught with a debugger attached, and the picture is now consistent. Same machine and stack as before (RTX 5070 Ti, Wine 11.22 Staging, GE-Proton11-14 vkd3d-proton). Offsets are for 1.0.2.1; no title code attached.
What the spinning worker is looking for. The lookup at
title+0x50eb750builds its key from the pool element it is handed: pool type, slot index, and a small field taken from that slot's word in the pool's per-slot table at the time of the call. The insert side (+0x35b70c0/+0x35b7200) builds the key the same way, at the time of the insert. In both captures the table holds an entry for the same type and slot whose field is exactly one lower than what the lookup computes:0x0c819280x08819280x18813cb0x14813cbSo the key is not missing because it was never inserted: the slot's word changed between the insert and the job's lookup. The low bits of the slot word in capture 2 point at another slot rather than holding the all-ones value its allocated neighbours have, which reads like a generation counter on a slot that has been freed since. In capture 2, 64 of the 691 live entries in the table no longer match their slot's current word, and every one I decoded is off by exactly one. So objects registered in the table are routinely released before the table is next cleared, and the freeze is the case where a job still holds one of them. The lookup has no exit for an absent key (a sibling at
+0x56c6340does stop at an empty slot), so it probes forever.What it is not. The clear-all at
+0x55bfa00is behaving: the job counter at+0x8d7a9b0reads0x80000001in both captures (waiter bit set, exactly one job outstanding, the stuck one), so the clear is correctly waiting on a job that never ends, and the table pointer and mask the job cached match the globals. Not a torn grow, not an early wake of the wait, nothing inside VIctory's or Wine's synchronisation.My reading (inference, not shown): the title relies on the registration and the jobs that use it happening close together, and on the console they do. Here a world frame takes 0.5 to 2 s, while whatever releases these objects keeps its own pace, so the window in which a registered object can be released before its job runs is far wider. That would also fit the stop appearing only in the world and more often on slower configurations. What I have not found is who releases the objects and whether that is supposed to be held off while jobs are pending; if someone knows that side of the title, that is the missing piece.
If that reading holds, the options on VIctory's side are to get the frame time down (the real cure) or to give that one lookup an exit for an absent key, which would need a way to patch title code that I do not think exists yet.
Method, for anyone who wants to repeat it: a loop that restarts the title until the frame lines stop for 45 s, then
gdb -pon the Wine process with a small Python script that reads the stuck thread's registers, the table globals at+0x876fc48/+0x876fc50and the pool table at+0xabbe7c0. Freezes here: 3 of 5 runs today, at 250 to 420 s.(AI-assisted, Claude Code: it wrote the probe and this text; I ran it on my machine.)
Edit: the Wine version was 11.22 Staging, not 11.21 (the system had updated before these runs).
@crashbashash on GitHub · 2026-11-24 19:59 UTC · original
@Mumogg @r4tedx a measurement on whether VIctory's copy-back can be what changes the slot words behind this stall. Local diagnostics patch on
94e0ea5(r4tedx's update 9, which has the most copy-back traffic), not for upstream. RX 6800 XT, RADV, GE-Proton11-14, three 10-minute runs in the world.In
Shadow::copy_back, for every 64 KiB piece that is written back, I count:write_mapped, so it's a lower bound.+0x876fc50, 144-byte groups, count at+0x876fc48) and with every pool's slot words (pool array at+0xabbe7c0, slot words at pool+0x28), re-read every 5 s.Two unit tests (run under Wine) check that each count sees what it should and ignores the other case.
So on this machine the copy-back never wrote into the memory this lookup reads, by either race, and the revert race didn't fire at all. That points away from VIctory corrupting these slot words, and towards your reading of a timing window inside the title that slow frames widen. No run stalled this time (it's intermittent, so that says nothing either way). The lost-to-a-shader bytes are real but land elsewhere; I don't know yet what they hit.
No game data attached. AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 03:51 UTC · original · edited 2026-11-25 06:52 UTC
Automated triage for the maintainers.
Where it stands:
RtlReleaseSRWLockExclusive ... is not owned exclusivemessages are not from VIctory or the title. The relay trace above puts every call on that lock in vkd3d-proton'sd3d12core.dll(its device memory allocation path), and the messages and the stop occur independently. That belongs upstream with vkd3d-proton.mainchanged the copy-back (commitscd94d35and940d32fincrates/victory-gpu): only pages that shaders mark as written are compared and written back, so a shader's bytes no longer go over newer title bytes. The two write-back counts from this thread, measured again onmainat940d32for later, would show whether that holds.This issue stays open as the Wine-side record of the stall. A
VICTORY_STACKSdump from someone else's stop would also help.Generated by Claude Code
@r4tedx on GitHub · 2026-11-25 04:30 UTC · original
@crashbashash thank you for measuring this, and for the two counters. A late answer, with one pointer that bears on your "title writes lost to a shader byte" row.
mainchanged the copy-back after your runs, incd94d35(with940d32fon top). By its commit message: translated shaders now mark the 64 KiB title pages they write through unordered buffer views, after a submission only the marked pages are compared and written back, and "a page the title writes while shaders may write it keeps its bytes from before (saved by the guard on the first write), so both writers' bytes survive". That is aimed at the case you counted (5,298 B in 186 pieces, 2,115 B in 99): a shader's byte going over a newer byte of the title's.I have read the commit, not run it. Your two counts on
mainat940d32for later would be the measurement that shows whether it holds.94e0ea5(update 9 ofintegration/testers) will not get this change: that tree stays at4744af9, its last update on the old base, as noted on #293.Your result that no written-back piece touched the lookup table or the pools' slot words stands as you stated it, and I have nothing to add to the triage's reading of a timing window.
Nothing was run for this comment.
AI-assisted (Claude Code).