Thread problem causing some calls to hang for 25

Thiago Macieira thiago at kde.org
Tue May 18 10:47:29 PDT 2010


Em Terça-feira 18 Maio 2010, às 17:00:51, Thiago Macieira escreveu:
> QTBUG-7475 is still not fixed. I'm investigating a bit more with helgrind.

That bug is a different issue.

It's a very basic race condition in protected_change_timeout (dbus-
connection.c). The code there unlocks the connection in order to call out to 
binding code. However, the moment that it unlocks, another connection may 
acquire the lock. When it reaches the same function, timeouts is NULL, so it 
will immediately fail.

That causes dbus_connection_send_with_reply (and and_block) to fail.

I see two solutions, neither of which pleasant:

1) loop inside protected_change_timeout until the "timeouts" structure 
reappears, by unlocking and relocking the connection (with a yield or sleep 
in-between).

2) don't drop the lock, but call out to binding code with the locks held in 
place. We can document that these callback functions need to be deadlock-safe.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20100518/7c521534/attachment.pgp>


More information about the dbus mailing list