A second punktfunk-client, launched by a link or a desktop shortcut, handed off to the running client and then never exited. Each click left a stuck process holding an SDL gamepad service. Streaming from several hosts (#2250) makes that path much more common.
Cause
gdb on the stuck process: the main thread sits in relm4::RelmApp::run, in MainContext::iteration(true) (relm4-0.11.0/src/app.rs:199). g_application_run has already returned by then, and a remote instance has no source that could fire.
Fix
Before app.run::<AppModel>, an idle arms a 50 ms timeout. The idle runs in GApplication's final drain and leaves a timer that is not ready yet, so relm4's blocking iteration has something to wake it.
Rejected
A plain idle. g_application_run ends with while (g_main_context_iteration(context, FALSE));, which drains every ready source first. That build hung: exit 124 in 3 of 3 runs.
adw_app.register() before RelmApp::run. relm4 builds the window in connect_startup.
Measured
In the pf-client-check image under Xvfb, with the real shell:
Case
Second instance
link, shell idle
exits 0 in about 110 ms
link, stream running
exits 0 in about 110 ms
bare launch
exits 0 in about 110 ms
The link still reaches the primary, the primary still quits normally, and the shell's 34 tests pass. Not checked on a real desktop session.
A second `punktfunk-client`, launched by a link or a desktop shortcut, handed off to the running client and then never exited. Each click left a stuck process holding an SDL gamepad service. Streaming from several hosts (#2250) makes that path much more common.
## Cause
gdb on the stuck process: the main thread sits in `relm4::RelmApp::run`, in `MainContext::iteration(true)` (`relm4-0.11.0/src/app.rs:199`). `g_application_run` has already returned by then, and a remote instance has no source that could fire.
## Fix
Before `app.run::<AppModel>`, an idle arms a 50 ms timeout. The idle runs in GApplication's final drain and leaves a timer that is not ready yet, so relm4's blocking iteration has something to wake it.
## Rejected
- A plain idle. `g_application_run` ends with `while (g_main_context_iteration(context, FALSE));`, which drains every ready source first. That build hung: exit 124 in 3 of 3 runs.
- `adw_app.register()` before `RelmApp::run`. relm4 builds the window in `connect_startup`.
## Measured
In the `pf-client-check` image under Xvfb, with the real shell:
| Case | Second instance |
| --- | --- |
| link, shell idle | exits 0 in about 110 ms |
| link, stream running | exits 0 in about 110 ms |
| bare launch | exits 0 in about 110 ms |
The link still reaches the primary, the primary still quits normally, and the shell's 34 tests pass. Not checked on a real desktop session.
A second launch hands its link or activation to the running client, then
never exits. relm4 ends `run` on a blocking main-context iteration, and
GApplication has already drained every ready source by then, so nothing
wakes it. Each shortcut click left a stuck process with a gamepad service.
An idle runs in that drain and leaves a timer for the iteration.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
A second
punktfunk-client, launched by a link or a desktop shortcut, handed off to the running client and then never exited. Each click left a stuck process holding an SDL gamepad service. Streaming from several hosts (#2250) makes that path much more common.Cause
gdb on the stuck process: the main thread sits in
relm4::RelmApp::run, inMainContext::iteration(true)(relm4-0.11.0/src/app.rs:199).g_application_runhas already returned by then, and a remote instance has no source that could fire.Fix
Before
app.run::<AppModel>, an idle arms a 50 ms timeout. The idle runs in GApplication's final drain and leaves a timer that is not ready yet, so relm4's blocking iteration has something to wake it.Rejected
g_application_runends withwhile (g_main_context_iteration(context, FALSE));, which drains every ready source first. That build hung: exit 124 in 3 of 3 runs.adw_app.register()beforeRelmApp::run. relm4 builds the window inconnect_startup.Measured
In the
pf-client-checkimage under Xvfb, with the real shell:The link still reaches the primary, the primary still quits normally, and the shell's 34 tests pass. Not checked on a real desktop session.