Hi

On 10 March 2015 at 10:11, Frederik Lotter <
frederik.lot...@mixtelematics.com> wrote:

> 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
>
>
>
>
I think I now understand my problem better. I think my mistake was stupid,
but due to a lack of experience using GLIB.

The problem seems to be that I should not make synchronous dbus method
calls from inside a g_signal_connect() callback. If the timing works out
that both sides (client calls) do this at the same time to each other's
server, you end up with a deadlock, which only resolves after the Dbus 25
timeout of the first call.

However, it looks like it is still safe to make synchronous calls from
other threads in each process.

Kind Regards,
Fred
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to