Is org.freedesktop.DBus.Error.NoReply the same as timeout?

Thiago Macieira thiago at kde.org
Wed Sep 4 15:42:43 UTC 2019


On Wednesday, 4 September 2019 03:34:58 PDT Alan Martinovic wrote:
> Hey,
> A call to a dbus method sometimes responds with
> 
> ```
> org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible
> causes include: the remote application did not send a reply, the
> message bus security policy blocked the reply, the reply timeout
> expired, or the network connection was broken.
> ```
> 
> There seems to be an attempt to offer potential explanations on what
> has happened.
> But in essence, is it safe to just treat it as a timeout always?

That depends on what "treat" means.. This error is synthesised by either the 
daemon or by the D-Bus library you're using when a timeout did happen. But 
there are other cases when it happens too, such as when the called service 
disconnects before replying. Notably, it happens when the connection to the 
bus fails too.

So it's more than a timeout. But you can probably behave the same way in all 
conditions as a result of this.

> If so, can one set a timeout for a dbus method call?

Yes. The default is 25 seconds. There are API calls to set the timeout in a 
DBusMessage in the reference library and higher-level APIs often offer a way 
to set it too.

There's an upper limit defined in the bus's configuration file. I think that 
defaults to 5 minutes. But since you can't really know what it's configured 
to, you shouldn't raise the timeout to more than a minute in your method 
calls. If the API you're designing has a chance of reaching 30 seconds between 
call and reply, you should redesign it so that it returns immediately saying 
"job started" and report conclusion later with a (directed) signal or a 
callback. This will also allow you to emit signals with progress reports.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel System Software Products





More information about the dbus mailing list