in dbus-connection.c: _dbus_connection_read_write_dispatch() may call _dbus_memory_pause_based_on_timeout() At (currently line 2182) the final else branch option uses a fixed timeout value of 1000. Presumably this is meant to be the timeout_milliseconds value passed in (which has been set by the client using the dbus API)?
_dbus_memory_pause_based_on_timeout() looks like it’s designed to be called with an ever-decreasing timeout, as the difference between the desired timeout and the elapsed time for a particular operation. It clamps the time it sleeps to 1s, so it ends up polling for new memory at 1s intervals (at most). When _dbus_connection_read_write() and _dbus_connection_read_write_dispatch() call it, they are not calling it in a loop with a decreasing timeout; so they’re at fault here. Although they are documented as using their timeout parameter as a ‘maximum timeout’, so their behaviour does match the documentation. Is this breaking a use case you have?
I have no particular use case, just investigating some behaviour of gpsd clients that can use dbus. It just appeared that the code in _dbus_memory_pause_based_on_timeout() looked intuitively wrong, and like a copy and paste error. So yes it can be for enforcing an upper value, and since it is just for memory allocation that's probably sensible behaviour.
Let’s close it then. Thanks for looking at this.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.