max_outgoing_bytes: What if a D-Bus peer is too slow to read?

Havoc Pennington hp at pobox.com
Thu Sep 30 13:38:42 PDT 2010


Hi,

On Thu, Sep 30, 2010 at 2:49 PM, Alban Crequy
<alban.crequy at collabora.co.uk> wrote:
>  if (_dbus_counter_get_size_value (transport->live_messages) >= transport->max_live_messages_size ||
>      _dbus_counter_get_unix_fd_value (transport->live_messages) >= transport->max_live_messages_unix_fds)
>    return DBUS_DISPATCH_COMPLETE; /* complete for now */
>
> Is it the function where the messages are dropped?

No, this code is just saying there aren't more messages to process for
the moment.

I think where it blocks the messages is here:

 if (!_dbus_message_add_size_counter (message, transport->live_messages_size))
        {
          _dbus_message_loader_putback_message_link (transport->loader,
                                                     link);
          status = DBUS_DISPATCH_NEED_MEMORY;
          break;

This ultimately should make dbus_watch_handle() on the socket return
FALSE and then dbus-mainloop.c ends up just waiting up to half a
second and then trying to read again. If the message queue then gets
drained, it should be able to read the next time.

If you set the limit lower than the size of a single message, it looks
like that message would never be sent and the connection would be
permanently crippled.

No guarantee any of this works properly. Turn on DBUS_VERBOSE (see
"man dbus-daemon" section DEBUGGING) and you can see what happens
probably.

Havoc


More information about the dbus mailing list