fix: let the texture table go before slot_evict takes it again #328
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!328
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-328"
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?
@Skyfrye on GitHub · 2026-11-26 03:31 UTC · original
Skyfrye:nep/slot-evict-deadlock→main· +3 −0 · 1 files · 1 commits · openChange
resource::let_go_idletakes the table of all textures (let all = textures();), sweeps it, and then callsslot_evictwithallstill held.slot_evicttakes the same table again (for &at in textures().iter()).TEXTURESis astd::sync::Mutex, which is not reentrant: the second lock on the submitting thread waits for itself for good. From then on every title thread that makes or releases a resource waits for that table too, and the title ends.slot_evictonly gets that far withVICTORY_SLOT_EVICT=1and the card's use overVICTORY_SLOT_EVICT_PERCENT(80) of its budget, which in the world is the moment it enters it. Before that it returns early, which is why the switch seemed to work in short runs.The fix:
drop(all)before the call.slot_evictalready does its own lookups under its own lock of the table.Linked issue: none.
Verification
Windows 11 26300, Rust 1.98.1 (MSVC), RTX 5080, on upstream
mainatc4c93bd, fromthird_party/victory:In the world, my copy of the game, launcher fast set with
VICTORY_INDIRECT_RAW=3, runs of 150-240 s:VICTORY_SLOT_EVICT=1unhandled exception 0xc0000005 ... (write 0x0: nothing mapped there)in the title, 0.5-1 min after it entered the world, the same instruction every timeVICTORY_SLOT_EVICT=1,VICTORY_SLOT_EVICT_PERCENT=97(the line never reached)VICTORY_SLOT_EVICTVICTORY_SLOT_EVICT=1How it was found: a build with a line logged at each step of
slot_evictnever logged one in the runs that ended (the firsttextures()of the function never returned), while the same runs with the line out of reach (97 %) ran on; readinglet_go_idleshowed the held guard.No test: the deadlock needs the card's budget over the line and textures made through the device. The revert check is the table above.
What this does not do: make
VICTORY_SLOT_EVICTfree much. In these runs 3.8 GB of host copies were "filled idle but held" and it let 13-15 MB go: most of them are held by slots that shaders pick by index, whichslot_evictleaves alone (nothing would make them again). That is a change of its own.Oracle and test data
No game file. The counts come from my own runs of my copy of the game; the instruction is named by its module offset only in my notes, not here.
Checklist
slot_evicttakes it).E_NOTIMPL), never a fake success. (Nothing unimplemented here.)AI assistance: written with Claude Code. Claude Opus 5.5 ran the crash runs and the step-by-step test builds, found the held guard, and wrote this description.
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.