Skip to content

Fix the deadlock - #78

Closed
GamerClassN7 wants to merge 5 commits into
PocketRelay:masterfrom
GamerClassN7:patch-1
Closed

GamerClassN7 wants to merge 5 commits into
PocketRelay:masterfrom
GamerClassN7:patch-1

Conversation

@GamerClassN7

@GamerClassN7 GamerClassN7 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Matchmaking::process_queue looped forever on the first queued player whose rules didn't match the game (NotMatch never advanced or removed the entry), while holding the queue mutex. Because parking_lot locks block whole tokio worker threads, every later matchmaking call piled up until the HTTP server and DB pool stopped responding. Separately, SessionData::clear_game/set_game dropped SessionGameData while holding the session write lock, and its drop re-acquires that same non-reentrant lock via remove_player → clear_game_gm, deadlocking the thread on itself. Both are fixed (index-based queue iteration, dropping the old game data after releasing the lock), but not yet tested.

Refactor set_game and clear_game methods to use replace and take for better handling of previous game data.
Refactor tunnel management by enhancing dead tunnel removal and association handling.
Refactor TunnelMappings struct to include new fields and remove dead tunnels logic.
@jacobtread jacobtread mentioned this pull request Nov 7, 2026
@jacobtread

Copy link
Copy Markdown
Member

Reopened as #79 with just the formatter ran and removing the extra .copied()

@jacobtread jacobtread closed this Nov 7, 2026
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.

2 participants