GNOME Bugzilla – Bug 749103
gdbusproxy stops tracking if dbus service restarts
Last modified: 2018-05-24 17:50:00 UTC
I created a DBus service and a client with glib (GDBUS).
To create an adaptor for the client I used the method:
mProxy = myService_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
As long as I understand this, basically a struct gets filled with the data I pass to the method (service-name, path, etc.). After that this creates a GDBusConnection which has the socket of the system bus as a property.
To call methods I use:
myService_call_myMethod_sync(mProxy, &res, NULL, &mError);
This works fine for my until my DBus service gets shut down during the client lifetime.
After that, the client requests are going into nowhere and the client isnt able to communicate with my dbus-service anymore.
I get errors like:
GLib-GIO-CRITICAL **: g_dbus_proxy_call_sync_internal: as sertion `error == NULL || *error == NULL' failed.
I think this is a bug, because normally the service should get started by the client if the name doesnt exist on the system bus.
To fix this I started to call the myService_dbus_adaptor_proxy_new_for_bus_sync-method in every client method with the exact same parameters. Now I can restart my dbus-service and the client is still able to communicate with it.
Why is it, that this GDBusProxy stops tracking if my DBus-service restarts? Like described above, my understanding is, that GDBusProxy is just a struct filled with data which remains the same. If no service with the specified name is running, my client should start the service. But that only works if I created a new proxy for that. Is this a bug?
You want to use `g_bus_watch_name()`.
-- GitLab Migration Automatic Message --
This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/1036.