Order of messages

David Rheinsberg david.rheinsberg at gmail.com
Mon May 27 06:24:02 UTC 2019


Hi

On Sun, May 26, 2019 at 4:33 PM Fabián Orccón <cfoch.fabian at gmail.com> wrote:
> The documentation of dbus states:
>
>> The bus daemon never reorders messages. That is, if you send two method call messages to the same recipient, they will be received in the order they were sent.
>
>
> I would like to know that if the order of these message is also kept across different APIs. For example, if a signal is emitted from foo.bar.A and after that another signal is emitted from moon.earth.B will the client receive the messages in this order?

Generally: No.

Messages are queued in kernel buffers between clients and dbus-daemon.
So if A sends a message to dbus-daemon, then B sends a message to
dbus-daemon, the daemon might process the incoming messages from B
before A. There is no way for dbus-daemon to know who sent the message
first. This is inherent to the D-Bus model, where each client has its
own receive-buffer in dbus-daemon.

Note that the order is guaranteed when you actually verify that a
message is processed by dbus-daemon. For instance, if A sends a
signal, then sends a *DBUS* message to B, which then triggers B to
send a signal, then the order is guaranteed. The intermediate
dbus-message serves as barrier. So ordering *inside* the D-Bus
ecosystem is fixed and well-defined. It only gets problematic if
somehow A and B communicate via side-channels.

Cheers
David


More information about the dbus mailing list