GDBus usage in multiple processes each hosting a GDbus server for the other process



Hi,

We are using DBUS extensively as low bandwidth communication for some APIs
shared between standalone processes. I was completely new to GDBus (and
GLIB) when I started implementing this, and now I have made a discovery
which I would like to check with some experts.

(I use the gdbus-codegen utility for generating the functions I use)

It turned out that once one of the processes [re]start,
the g_bus_watch_name_on_connection() will fire from both processes, each
discovering the other.

The problem was that I have implemented all my GDBus calls as synchronous
calls, and at this point of discovery the two processes entered a live lock
until one of the calls time out of 25 seconds.

I have now replaced the call inside the "busNameAppeared" callback to be
all Asynchronous. This fixes the problem.

However, the rest of the client side calls are all synchronous calls
(blocking) from both sides (both processes).

Is this a potential problem?

If both sides are making a sync call to the server at the same time, will
the server side processing happen in a different thread, or will the same
live lock issue appear.

I am not sure how many threads are spawned or if *everything* gdbus runs on
the main loop thread.

Any help will be greatly appreciated.

Frederik Lotter

Mix Telemtatics, South Africa


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]