fix: read CurrentDNSServer over a private, mainloop-less bus #119
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/dns-watchdog-dbus-thread"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem. The #95 DNS watchdog has never worked in the running service.
current_dns_server()calleddbus.SystemBus()from the watchdog thread and got the process-shared connection glued to the Qt main loop (DBusQtMainLoop(set_as_default=True)in the service), which the main thread owns. Qt refuses cross-thread timers, the CurrentDNSServer read failed on every tick, andwatch_dns_primarylooped oncontinueforever — a stranded fallback selection was never returned to the primary. Only trace:QObject::startTimer: Timers cannot be started from another threadin the journal every 15s while a tunnel is up.Fix. Read over a private, mainloop-less connection (
dbus.SystemBus(private=True, mainloop=dbus.mainloop.NULL_MAIN_LOOP)), closed after each poll. Blocking calls need no mainloop, and this stops sharing one connection between two threads.Verification. Repro harness under the service's exact conditions (DBusQtMainLoop default on the main thread, read from a worker thread) against the live system:
274 tests pass.
Closes #117
🤖 Generated with Claude Code
58baf74754825e25d324825e25d3246486066824