Skip to content

KVM watchdog: restart the headless Deskflow server when it hangs (0.3.33) - #89

Merged
NickMarcha merged 1 commit into
mainfrom
kvm-watchdog
Nov 22, 2026
Merged

NickMarcha merged 1 commit into
mainfrom
kvm-watchdog

Conversation

@NickMarcha

Copy link
Copy Markdown
Owner

On 2026-11-22 at 08:20, sagehub's deskflow-core stopped answering. The process stayed alive, but clients couldn't connect and the thumb button got "The KVM isn't reachable: timed out". SIGTERM did nothing until systemd's 90 s stop timeout. Nothing could be controlled until it was restarted by hand.

  • kvm.probe() sends switch=-bragi-probe- to the core socket. No computer has that name, so the core thread has to answer "isn't connected", and nothing switches. noop wouldn't work: Qt's main thread serves the IPC socket, and it kept answering while the core thread hung.
  • kvm.watchdog probes every 20 s. After three misses in a row, kvm_config.kill_hung_engine logs each thread's wait channel (the hub has no debugger) and runs systemctl --user kill --signal=SIGKILL; Restart=always starts the server again.
  • A missing socket or refused connection counts as no server, which is systemd's job. It never triggers a kill.

Tests: pytest 493 passed under Linux (WSL), including the new probe and watchdog tests against a fake core socket that stops answering.

🤖 Generated with Claude Code

On 2026-11-22 at 08:20 the hub's deskflow-core stopped answering: the
process stayed alive, clients couldn't connect, the thumb button timed
out, and SIGTERM did nothing until systemd's 90 s stop timeout.

Bragi now probes the server every 20 s with `switch=-bragi-probe-`, a name
no computer has, so the core thread has to answer "isn't connected" and
nothing switches. `noop` wouldn't do: Qt's main thread serves the IPC
socket and kept answering while the core thread hung. After three missed
probes Bragi logs each thread's wait channel and SIGKILLs the unit;
Restart=always starts it again. A stopped server (no socket) is left to
systemd.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@NickMarcha
NickMarcha merged commit 6da6d70 into main Nov 22, 2026
@NickMarcha
NickMarcha deleted the kvm-watchdog branch November 22, 2026 09:00
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