[PR #480] [MERGED] fix(lobby): Controller lost when joining a running lobby. #491

Closed
opened 2026-10-15 13:00:58 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/games-on-whales/wolf/pull/480
Author: @dustuu
Created: 8/17/2026
Status: ✅ Merged
Merged: 9/7/2026
Merged by: @ABeltramo

Base: stable ← Head: dustuu/lobby-fix


📝 Commits (2)

  • 47bf32a fix: plug joypads into lobby before registering the session as connected
  • 028a6b9 build: remove stale liblibgstwaylanddisplay COPY

📊 Changes

2 files changed (+16 additions, -17 deletions)

View changed files

📝 docker/wolf.Dockerfile (+0 -1)
📝 src/moonlight-server/sessions/lobbies.cpp (+16 -16)

📄 Description

Joining a lobby can leave the game container without a working controller. The pad still works in the Wolf UI session and first launches are always fine, but a few quit/rejoin cycles will reliably trigger it. The cause is that the join handler adds the session to connected_sessions before migrating its joypads, so the UnplugDeviceEvent meant for the old session's runner also gets relayed to the lobby runner, where it races the queued plug and can remove the device right after it was added.

I reordered the join to do what leave_lobby already does (migrate devices first, then register the session) and pointed the queued plug at the lobby id directly, which makes the old global plug event redundant.

The second commit fixes the runner stage COPY of liblibgstwaylanddisplay. cargo-c installs it into the libdir, not /usr/local/lib, so the build fails under podman/buildah. I needed that fix to build and test this locally.

Tested with 10 quit/rejoin cycles plus a force-close on the patched build, no failures. Stock loses the controller within a couple of joins (logs below).

Logs:

BEFORE (wolf:stable @ 7f416ec), same repro, two consecutive joins:

join 1, controller survives (the relayed unplug happens to land before the queued plug):

16:27:44.265185  [LOBBY] Unplug device for session 915...              // relayed unplug, misdirected at the lobby
16:27:44.265911  [DOCKER] Plugging device from queue: 2c7fab99...      // plug lands last, pad works

join 2, controller lost (queued plug drains first, the relay kills it 9ms later):

16:28:28.511     [DOCKER] Plugging device from queue: 2c7fab99...      // pad plugged into lobby container
16:28:28.520     [LOBBY] Unplug device for session 915...              // relayed unplug fires
16:28:28.520     [DOCKER] Received UnplugDeviceEvent: 2c7fab99...      // pad removed from lobby container

AFTER (patched), every join looks like this:

17:33:03.739     [LOBBY] Session 915... joining lobby d0df57f4...
17:33:03.739     [DOCKER] Received UnplugDeviceEvent: 915...           // old session's container only
17:33:03.852     [DOCKER] Plugging device from queue: d0df57f4...      // lobby plug, nothing racing it

11 joins total (10 quit/rejoin plus 1 extra where I force-closed the client). The "[LOBBY] Unplug device" relay line never shows up at join and the controller worked in game every time.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/games-on-whales/wolf/pull/480 **Author:** [@dustuu](https://github.com/dustuu) **Created:** 8/17/2026 **Status:** ✅ Merged **Merged:** 9/7/2026 **Merged by:** [@ABeltramo](https://github.com/ABeltramo) **Base:** `stable` ← **Head:** `dustuu/lobby-fix` --- ### 📝 Commits (2) - [`47bf32a`](https://github.com/games-on-whales/wolf/commit/47bf32a8206d170741eb5829bb67c00609b04e74) fix: plug joypads into lobby before registering the session as connected - [`028a6b9`](https://github.com/games-on-whales/wolf/commit/028a6b95b565475c5e5596ded15a7b2149afd4c3) build: remove stale liblibgstwaylanddisplay COPY ### 📊 Changes **2 files changed** (+16 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `docker/wolf.Dockerfile` (+0 -1) 📝 `src/moonlight-server/sessions/lobbies.cpp` (+16 -16) </details> ### 📄 Description Joining a lobby can leave the game container without a working controller. The pad still works in the Wolf UI session and first launches are always fine, but a few quit/rejoin cycles will reliably trigger it. The cause is that the join handler adds the session to connected_sessions before migrating its joypads, so the UnplugDeviceEvent meant for the old session's runner also gets relayed to the lobby runner, where it races the queued plug and can remove the device right after it was added. I reordered the join to do what leave_lobby already does (migrate devices first, then register the session) and pointed the queued plug at the lobby id directly, which makes the old global plug event redundant. The second commit fixes the runner stage COPY of liblibgstwaylanddisplay. cargo-c installs it into the libdir, not /usr/local/lib, so the build fails under podman/buildah. I needed that fix to build and test this locally. Tested with 10 quit/rejoin cycles plus a force-close on the patched build, no failures. Stock loses the controller within a couple of joins (logs below). **Logs:** BEFORE (wolf:stable @ 7f416ec), same repro, two consecutive joins: join 1, controller survives (the relayed unplug happens to land before the queued plug): 16:27:44.265185 [LOBBY] Unplug device for session 915... // relayed unplug, misdirected at the lobby 16:27:44.265911 [DOCKER] Plugging device from queue: 2c7fab99... // plug lands last, pad works join 2, controller lost (queued plug drains first, the relay kills it 9ms later): 16:28:28.511 [DOCKER] Plugging device from queue: 2c7fab99... // pad plugged into lobby container 16:28:28.520 [LOBBY] Unplug device for session 915... // relayed unplug fires 16:28:28.520 [DOCKER] Received UnplugDeviceEvent: 2c7fab99... // pad removed from lobby container AFTER (patched), every join looks like this: 17:33:03.739 [LOBBY] Session 915... joining lobby d0df57f4... 17:33:03.739 [DOCKER] Received UnplugDeviceEvent: 915... // old session's container only 17:33:03.852 [DOCKER] Plugging device from queue: d0df57f4... // lobby plug, nothing racing it 11 joins total (10 quit/rejoin plus 1 extra where I force-closed the client). The "[LOBBY] Unplug device" relay line never shows up at join and the controller worked in game every time. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 13:00:58 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
games-on-whales/wolf#491
No description provided.