D19514: Add support for detecting avahi crash - cleanup invalid dbus objects in that case

Jiří Paleček noreply at phabricator.kde.org
Mon Mar 4 14:52:51 GMT 2019


jpalecek created this revision.
Herald added a project: Frameworks.
jpalecek requested review of this revision.

REVISION SUMMARY
  This is a first take at tackling a problem caused by avahi going out of service -- usually its restart during an upgrade. In the current state, these things happen:
  
  - kdnssd holds dbus paths of avahi objects that no longer exist. Eventually, it calls methods on those paths, which might or might not exist or designate different objects
  - the client won't discover that published addresses/browsing addresses etc. don't work anymore. Ironically (this happens with kopete), the client will get some error message in the moment avahi comes //alive// again, not when it's going dead
  - KDNSSD objects used with this avahi instance stop working, and are unusable in the future
  
    In this diff, mostly the first problem is tackled. I add a new singleton class, ##AvahiDisconnectListener##, which will provide a signal when avahi goes away. Every KDNSSD object would listen for that signal and perform the necessary cleanup. This means, in this diff, mostly deleting dbus objects and clearing dbus addresses. On top of that, the ##PublicService## class is changed that it reports failure to publish with a ##published(false)## signal, and a ##RemoteService## reports failure with ##resolved(false)##. The latter should be able to restart when convienient with ##resolveAsync##. Other objects are simply left in a consistent, but nonworking state and can't be used anymore, because they lack the signals to signal error, and methods to restart their operations. Looking forward, this patch could be extended by adding aforementioned error signals, or even, providing a much better user experience, automatically restarting normal operation when avahi comes on again. That information is doable in the client, but is tedious and error prone, as it needs listening for DBus ##NameOwnerChanged##, and then correctly wait because Avahi isn't ready for business right away. Also, you need to manage all the race conditions.

TEST PLAN
  Launch kopete with an (online) Bonjour Account and run
  
    WARNING: this stops avahi
    # systemctl mask avahi-daemon.socket; systemctl stop avahi-daemon;
  
  kopete should notice immediately that Bonjour isn't online anymore. Ideally, when you restart avahi with
  
  1. systemctl unmask avahi-daemon.socket; systemctl start avahi-daemon
  
    kopete should make Bonjour online immediately, however that neds more work

REPOSITORY
  R272 KDNSSD

BRANCH
  wip-merged

REVISION DETAIL
  https://phabricator.kde.org/D19514

AFFECTED FILES
  src/CMakeLists.txt
  src/avahi-disconn-handler.cpp
  src/avahi-disconn-handler.h
  src/avahi-domainbrowser.cpp
  src/avahi-publicservice.cpp
  src/avahi-publicservice_p.h
  src/avahi-remoteservice.cpp
  src/avahi-servicebrowser.cpp
  src/avahi-servicebrowser_p.h
  src/avahi-servicetypebrowser.cpp
  src/avahi_listener.cpp
  src/avahi_listener_p.h

To: jpalecek
Cc: kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190304/07cc5518/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list