Skip to content

dnssd: Prevent crashes after releasing resolver

Ondrej Holy requested to merge wip/oholy/dnssd-crashes into master

The following error often happens when mounting dav+sd share (e.g. created over gnome-user-media) and the mount operation fails for some reason:

dbus[47482]: arguments to dbus_connection_unref() were incorrect, assertion "connection->generation == _dbus_current_generation" failed in file ../../dbus/dbus-connection.c line 2823. This is normally a bug in some application using the D-Bus library.

This is because avahi is not thread-safe and our resolver doesn't use mutexes. But it seems to me that mutexes are not necessarily needed if everything would work as expected. Unfortunately, changes made by commit 3384af82 causes that start_avahi_resolver is being called multiple times by mistake, which also calls avahi_service_resolver_new multiple times. Consequently, it may crash when resolver is beeing freed too early as there might still be unexpected pending operations using avahi client.

Fixes: #449 (closed)

Merge request reports