DBus-GLib 0.76 released

David Zeuthen david at fubar.dk
Thu Jun 5 17:34:11 PDT 2008


On Thu, 2008-06-05 at 23:34 +0200, Michael Biebl wrote:
> 2008/6/5 Colin Walters <walters at verbum.org>:
> 
> >  - New function to specify default timeout for calls on proxy
> 
> Does that really work? 

Yes, in effect it just allows users of these bindings to set
timeout_milliseconds as defined here

http://dbus.freedesktop.org/doc/api/html/group__DBusConnection.html#ga951b2a6f6c4069fa392752000b24ebe

  If -1 is passed for the timeout, a sane default timeout is used. -1 is
  typically the best value for the timeout for this reason, unless you
  want a very short or very long timeout. There is no way to avoid a
  timeout entirely, other than passing INT_MAX for the timeout to mean
  "very long timeout." libdbus clamps an INT_MAX timeout down to a few
  hours timeout though.

Looking at the libdbus source code this is what happens

  if (timeout_milliseconds == -1)
    timeout_milliseconds = _DBUS_DEFAULT_TIMEOUT_VALUE;

  /* it would probably seem logical to pass in _DBUS_INT_MAX for
   * infinite timeout, but then math in
   * _dbus_connection_block_for_reply would get all overflow-prone, so
   * smack that down.
   */
  if (timeout_milliseconds > _DBUS_ONE_HOUR_IN_MILLISECONDS * 6)
    timeout_milliseconds = _DBUS_ONE_HOUR_IN_MILLISECONDS * 6;

where

 $ grep DEFAULT_TIMEOUT *.h
 dbus-connection-internal.h:#define _DBUS_DEFAULT_TIMEOUT_VALUE (25 * 1000)

Thus

 - The default "sane" timeout using libdbus.so is 25 seconds; this 
   is probably fine

 - Maximum timeout, using libdbus.so, appears to be six hours due to
   implementation snafu

 - the API of libdbus.so specifies a 32-bit signed integer in msec
   so maximum timeout is 49.52 days.. we can probably special case
   INT_MAX to mean forever. 

   (Or if we don't want to break that tiny bit of libdbus.so ABI (to
   allow people passing INT_MAX to really get 49.52 days.. IMHO would be
   stupid) we can define -2 to mean forever since all the negative
   numbers except for -1 are currently forbidden.)

> I mean, dbus-daemon has it's own timeout (5min iirc).

Correct

http://lists.freedesktop.org/archives/dbus/2008-March/009486.html

> Does this also require an update of dbus or what is your recommendation?

There's generally consensus to fix all this

 http://lists.freedesktop.org/archives/dbus/2008-March/009490.html

where "fix" means

 - making timeout_milliseconds==INT_MAX mean forever in libdbus.so
 - removing the six hour clamp
 - defaulting the bus to never time out (but can be overridden by
   the config file)

Someone just needs to do the work.

      David




More information about the dbus mailing list