[python] timeout during async call

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Nov 14 08:10:59 PST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 14 Nov 2007 at 16:03:53 +0100, René 'Necoro' Neumann wrote:
> Yes - it is waiting for the reply to be sent, as this function has to
> return in sync. - But the exception is thrown by DBus. How can an async
> call time out?

All D-Bus method calls time out (eventually), to avoid using up
resources in libdbus (in the caller, and also in the bus daemon). Pass
a keyword argument "timeout" to the asynchronous call, giving the
timeout you want in seconds (e.g. "timeout=25" which I believe is the default).

libdbus provides no way to wait forever, but you can set a timeout of up
to 2**31 milliseconds, so the maximum timeout= argument in Python is about
2 million seconds (or, more than than 23 days).

However, if you have many pending method calls in parallel, you may
start to hit resource limits in the bus daemon (it limits the number of
pending calls - I think it's to 32 on the system bus, and a million or so
on the session bus). You could consider using an API where the method returns
immediately, and progress/status thereafter is signalled by signals.

    Simon
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net

iD8DBQFHOx4TWSc8zVUw7HYRAhaSAJ0QsuaYaPIyq9aN/ZzQE+I1DXn7MACgjzSp
NsiYjQFW+nke49xEeaZLy9A=
=rEHx
-----END PGP SIGNATURE-----


More information about the dbus mailing list