GPU: release presenter mutex before recursive two-plane fallback #1459
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1459
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1459"
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?
@steven-seagull27 on GitHub · 2026-11-28 20:20 UTC · original
steven-seagull27:fix/presenter-lock-drop→main· +3 −3 · 1 files · 1 commits · merged 2026-11-29 08:16 UTCCommit
c9876bfrefactoredself.presenterfromMutex<Option<Presenter>>toMutex<Presentation>(let mut presentation = self.presenter.lock()...; let Presentation { presenter, retry } = &mut *presentation;), leavingdrop(presenter)in all three two-plane composer fallback paths insideHost::present_planes(crates/victory-gpu/src/host.rslines 10800, 10843, and 10903).Because
presenteris now&mut Option<Presenter>,drop(presenter)is a no-op (flagged bydropping_references) while theMutexGuardpresentationremains held across the recursiveself.present_planes(texture, state_u32, None, frame, video)call — causing a guaranteed self-deadlock onself.presenter.lock()whenever two-plane composer creation or recording falls back to the base plane.This change drops
presentationinstead ofpresenterat all three fallback sites, releasing the lock before recursing and clearing all threedropping_referenceswarnings.Verification (synthetic tests only)
923e38c, Windows 11 x64, Rust 1.98.1 MSVC.cargo test --locked -p victory-gpu --lib host::tests -- --nocapture: 71 passed, 0 failed.cargo check --locked -p victory-gpu --all-features: passes with zero warnings inhost.rs(all 3dropping_referenceswarnings cleared).crates/victory-gpu/src/host.rs(pre-existinglower.rssize warning inxtask policyuntouched).AI-assisted. Synthetic verification only.
@babuakhil on GitHub · 2026-11-28 21:05 UTC · original
Independent confirmation: I hit the same bug from clippy on
main(923e38c) and arrived at the identical three-line change before finding this PR.Cause, as I read it:
c9876bf(swap-chain retry) changedlet mut presenter = self.presenter.lock()…intolet mut presentation = …; let Presentation { presenter, retry } = &mut *presentation;. From then ondrop(presenter)drops only the&mut, so the three base-plane fallbacks callpresent_planesagain while still holding the guard, and that call locks the sameMutexon the same thread. Droppingpresentationrestores whatdrop(presenter)did beforec9876bf.Checked here (Windows 11, RTX 3060, Rust 1.98.1), with this change on
923e38c:dropping_referenceserrors are gone from both clippy builds (with and without--all-features)cargo test -p victory-gpu --lib --locked: 5 of 5 full runs passed. Two earlier runs each had one failure:descriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytes, which also fails on plainmain(1 of 10 runs alone), andwatch::tests::faults_that_take_no_lock_tell_the_same;watchtests fail now and then onmaintoo (another one did in my runs without this change), and neither area is touched hereNot checked: the fallback paths themselves. They only run when the composer can't be made or the composite can't be recorded, which no test reaches, and I haven't run the game.
Note for CI: on current
main, clippy stops at twovictory-shadererrors (lower.rs: an unusedcolour, a manual checked division) before it reachesvictory-gpu, so CI won't show thesedropping_referenceserrors until those are fixed. #1470 also lists "a hang on the present's fallback" and may overlap.github-bot referenced this pull request2026-11-28 21:19:16 +00:00
@nick0451 on GitHub · 2026-11-28 21:44 UTC · original
A smoke test in play: RTX 3090 24 GB (driver 610.88), i9-14900K, Windows 11. A release build of this PR merged onto main
923e38c, run in turn with main and three other PR builds. Series S, DLSS Performance, frame generation off. The same frozen save, outdoors on a balcony, standing still. Two rounds, each run 40 s to settle and 60 s measured, then a screenshot.ERRORline in about 7 minutes of play. The two-plane composer fallback this fixes was not reached in this scene, so this shows only that the change does no harm on the normal present path.drop(presentation)releases the guard before the recursivepresent_planes, wheredrop(presenter)only dropped a reference.Tested with an AI assistant (Claude Code); results are from this PC.
github-bot referenced this pull request2026-11-28 21:54:24 +00:00