Repository navigation
Synchronization waits retain their objects and completed notifications - #1284
Closed
rastapasta wants to merge 1 commit into
Closed
rastapasta wants to merge 1 commit into
rastapasta wants to merge 1 commit into
Conversation
WaitSynchronization retains the resolved objects rather than caller memory and recyclable handle slots. Complete waits under the scheduler lock so clearing an event before the waiter resumes cannot erase its notification. Keep closed objects alive until their final wait reference is released. Reject thread handles in ResetSignal and distinguish an already-clear readable event from an invalid handle. Add deterministic notification, cancellation, close/reuse and endpoint tests to normal and sanitizer targets.
rastapasta
force-pushed
the
fix/kernel-wait-lifetimes
branch
from
November 5, 2026 06:27
785868f to
ff1367d
Compare
3 tasks done
seedds
added a commit
that referenced
this pull request
Nov 7, 2026
…ignal that completed it, as Horizon's KSynchronizationObject::Wait: a signal followed by a clear before the waiter resumed timed out the wait, a closed and reused handle redirected it, and a wait on a thread whose handle was closed never completed; every handle is validated up front (more than 64 is out of range, the pseudo-handle and an event's write end are invalid), a ready object and a zero-time poll precede a pending cancellation, the retained list lives in the thread's record, and ResetSignal on a thread is an invalid handle (PR #1284) Co-authored-by: Michael Straßburger <1259904+rastapasta@users.noreply.github.com>
Owner
|
Thank you. Landed on main as db206a4, with you as co-author. The change matches Horizon's KSynchronizationObject::Wait, and t_sync_wait reproduces six of its seven groups on the old host. Changes on top of the PR:
Checked: the host unit tests, the thread-sanitizer suite ( |
Know-It-All-Brother
pushed a commit
to Know-It-All-Brother/nxnative
that referenced
this pull request
Nov 9, 2026
…ignal that completed it, as Horizon's KSynchronizationObject::Wait: a signal followed by a clear before the waiter resumed timed out the wait, a closed and reused handle redirected it, and a wait on a thread whose handle was closed never completed; every handle is validated up front (more than 64 is out of range, the pseudo-handle and an event's write end are invalid), a ready object and a zero-time poll precede a pending cancellation, the retained list lives in the thread's record, and ResetSignal on a thread is an invalid handle (PR seedds#1284) Co-authored-by: Michael Straßburger <1259904+rastapasta@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
A wait kept caller memory and recyclable handle slots instead of retaining the objects it was waiting on. Closing or reusing a handle could redirect it, and clearing an event before the waiter resumed could erase an already delivered notification.
Resolve and retain the complete wait list, record completion under the scheduler lock, and release object references when the wait ends. Preserve validation, readiness, timeout and cancellation ordering.
ResetSignalnow rejects thread handles with InvalidHandle and reserves InvalidState for an already-clear readable event.Threading reference. The deterministic tests hold the scheduler lock across notification and clear/close, so they exercise the race without timing sleeps.
Checked
t_sync_waitgroups pass normally, under ASan/UBSan, and under TSan. The tests cover notification completion, endpoint types, wait-list validation/snapshots, cancellation, handle reuse and thread lifetime. Documentation and usage-map tests pass; C lint has no new findings.regress.py impact origin/main..HEADcompleted. The five-game check selected Ocarina, Wonder, Dark Souls, Hades and Mario Kart World to cover synchronization across several engines and graphics paths. It stops at preflight with exit 2: only Ocarina has a local Mac build. Metal cache cleanup was skipped to preserve the ongoing shader build. Game regression coverage remains outstanding.Docs