Mailinglist Archive: yast-devel (41 mails)

< Previous Next >
[yast-devel] Timeout problem in SCR DBus service
  • From: Ladislav Slezak <lslezak@xxxxxxx>
  • Date: Fri, 06 Feb 2009 17:48:33 +0100
  • Message-id: <498C69E1.8040702@xxxxxxx>

Hi all,

Klaus has noticed that it takes quite long time to process requests by the SCR
DBus
service. I have noticed that in the past too but I didn't pay attention to
this, I
thought that DBus is so slow...

Now I have found the problem: connection.setTimeout() in Yast calls
dbus_connection_read_write() function which should wait for an incoming DBus
message
or timeout (after 5 seconds in this case).

But for some reason (a bug?) it does not return immediately when a DBus _signal_
message is received, it times out instead.

Unfortunately two signals are sent by DBus itself automatically at service
startup
(signal NameAcquired from interface org.freedesktop.DBus). So there is a delay
2*timeout which means 10 seconds in this case :-(

The fix is quite simple - try reading from DBus and if there is no message
_then_
call dbus_connection_read_write() function to wait for an message. With this
patch
the signals at start up are read immediately from the input queue.

See the attached patch.

Klaus, Schubi, please test the patch, I'd like to submit it to RC4 on monday...


--

Best Regards

Ladislav Slez√°k
Yast Developer
------------------------------------------------------------------------
SUSE LINUX, s.r.o. e-mail: lslezak@xxxxxxx
Lihovarsk√° 1060/12 tel: +420 284 028 960
190 00 Prague 9 fax: +420 284 028 951
Czech Republic http://www.suse.cz/
Index: DBusServer.cc
===================================================================
--- DBusServer.cc (revision 55224)
+++ DBusServer.cc (working copy)
@@ -150,14 +150,15 @@
}
}

- // set 5 seconds timeout
- connection.setTimeout(5000);
// try reading a message from DBus
DBusMsg request(connection.receive());

// check if a message was received
if (request.empty())
{
+ // wait for an incoming message, set 5 seconds timeout
+ connection.setTimeout(5000);
+
continue;
}

< Previous Next >
Follow Ups