hle(posix): fix WaitForMultipleObjects rollback wakes, SetWaitableTimer rearm races, and WaitForThreadpoolWorkCallbacks cancel #494
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS#494
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?
@Sheffy007 on GitHub · 2026-11-27 22:08 UTC · original
Summary
Three Win32 synchronisation and callback-cancellation bugs in
crates/victory-hle/src/host_posixcan wake threads prematurely, strand concurrent multi-object waiters, or run cancelled work callbacks after their caller freed their context (Refs #460):Waitable::give_back(crates/victory-hle/src/host_posix.rs:643-653):WaitForMultipleObjects(..., wait_all = 1)rolls back a partial take,give_backrestores auto-resetEvent,Semaphore, andMutexobjects without callingsync::signalled(), leaving any concurrentWaitForMultipleObjects(..., wait_all = 0)waiter asleep onEPOCH.give_backalso callse.set()unconditionally on manual-reset events (whichtry_takenever consumed), overwriting a concurrentResetEvent.SetWaitableTimer/CancelWaitableTimer(crates/victory-hle/src/host_posix/system.rs:1363-1463):while live()(generationcheck) andtimer.event.set(): a preempted worker from a supersededSetWaitableTimerorCancelWaitableTimercan calltimer.event.set()after a newSetWaitableTimerincrementedgenerationand calledtimer.event.reset(), signalling the re-armed timer early before its newduetime elapses.SetWaitableTimercall also spawns a fresh OS thread that stays blocked instd::thread::sleepacross cancel, re-arm, andCloseHandle.WaitForThreadpoolWorkCallbacks(crates/victory-hle/src/host_posix/system.rs:1765-1768):_cancel(fCancelPendingCallbacks), passingfalseinstead ofcancel != 0toPoolObject::wait_idle(unlikeWaitForThreadpoolTimerCallbacksright below it), so pendingSubmitThreadpoolWorkcallbacks still run afterWaitForThreadpoolWorkCallbacks(work, 1)returns.@Sheffy007 on GitHub · 2026-11-27 22:08 UTC · original
/claim
@github-actions[bot] on GitHub · 2026-11-27 22:08 UTC · original
Claimed by @Sheffy007. Open a draft pull request with
Refs #490in its description within 24 hours, or the claim expires.