Skip to content

fix(ppsspp-debug): Client.close() is safe from several threads - #47

Merged
sp00ktober merged 1 commit into
mainfrom
fix/client-close-race
Oct 2, 2026
Merged

sp00ktober merged 1 commit into
mainfrom
fix/client-close-race

Conversation

@sp00ktober

Copy link
Copy Markdown
Contributor

Two threads closing one Client could hang: the second close scheduled onto a loop the first had already stopped and waited on it forever (seen in the HUD's tests, modkit#46). A lock now orders scheduling against stop, _Loop.stop runs once and later callers wait for it, and close ignores the Disconnected of a client closed meanwhile.

Tested: test_close_from_many_threads (40 clients, 4 closers each) failed on main 3 of 3 runs and passes 15 of 15 now; pytest packages/ppsspp-debug packages/mhfu 381 passed, 49 skipped; mypy strict, pre-commit.

🤖 Generated with Claude Code

A second close could schedule onto a loop the first had stopped and wait on it forever. A lock
orders scheduling against stop, stop runs once and later callers wait for it, and close ignores
the Disconnected of a client closed meanwhile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sp00ktober
sp00ktober merged commit 382dcfb into main Oct 2, 2026
5 checks passed
@sp00ktober
sp00ktober deleted the fix/client-close-race branch October 2, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant