Thread problem causing some calls to hang for 25

Carlsson, Johannes Johannes.Carlsson.x at
Mon May 31 06:56:45 PDT 2010

Hi again

Have you seen any problems when testing the fixes or are they maybe ready to be applied?


-----Original Message-----
From: at [ at] On Behalf Of Thiago Macieira
Sent: den 20 maj 2010 11:50
To: dbus at
Subject: Re: Thread problem causing some calls to hang for 25

Em Quinta-feira 20 Maio 2010, às 08:02:39, Carlsson, Johannes escreveu:
> Hi Guys
> At Sony Ericsson this problem was quite frequent when turning on and 
> off Bluetooth on our Android phone (Xperia X10i mini). Sometimes this 
> operation took ~25s extra. We also managed to reproduce the problem on 
> a Google G1, but this was a bit harder to do. I also reproduced it 
> very frequently by adding a delay for every 3:rd (or something) call 
> to _dbus_connection_acquire_io_path right after the connection lock 
> had been released (I think this was the place at least).
> When looking into the code for _dbus_connection_acquire_io_path I 
> noticed that it releases the connection lock for a while. During this 
> period another thread might already read the response and either put 
> it in the incoming messages queue or already flagged it as completed 
> (depending on which thread/call that did the actual reading). In 
> Android there are several threads accessing the dbus-library at the 
> same time, one which is dispathing events 
> (android_server_BluetoothEventLoop.cpp) which calls dbus_watch_handle 
> and a number of threads that will call dbus_connection_send_with_reply (android_bluetooth_common.cpp).
> I tested this solution and it fixed this problem spot on (I tested by 
> leaving the phone over night with a special sw that turned on and off 
> Bluetooth constantly). During this test we also found a fd leak in the 
> Android code, but that is another story :)
> Is this patch something you could consider applying?

Yes, I think it should be applied. It did fix an issue for me.

I'm running KDE for a couple of days with all the fixes applied to see if I notice any regressions.
Thiago Macieira - thiago (AT) - thiago (AT)
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

More information about the dbus mailing list