assertion failed "!(connection)->have_connection_lock"

Thiago Macieira thiago at kde.org
Sun Aug 9 12:36:36 PDT 2009


Jean-Christian de Rivaz wrote:
>Thiago Macieira a écrit :
>> Jean-Christian de Rivaz wrote:
>>> So I tryed the new 1.3.0 revision and I still get it, only the line
>>> number change:
>>> 389: assertion failed "!(connection)->have_connection_lock" file
>>> "dbus-connection.c" line 2567 function dbus_connection_ref
>>>
>>> The application basically get a lot of UNIX signals (about 10 per
>>> seconds) and a few dbus signals per seconds. It run some magic and
>>> sometime produce a dbus signal. The problem occur rarely, but alway
>>> at the same dbus_connection_flush() call.
>>
>> Just so we're clear: by "run some magic and sometime produce a dbus
>> signal", you don't mean inside the Unix signal handlers, right?
>
>Unfortunately yes.
>
>By the way you asked the question, I suppose that's a bad thing. So I
>serialized the signal handling into the main loop and now I can't
>reproduce the assertion after more than one hour of test.
>
>It seem that you have pointed out the right problem. Thanks a lot !

Yes, it's a bad thing.

See 
http://www.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04

There's a list a bit further down of functions that you may call from 
inside a signal handler. You can only call those and functions that call 
those.

D-Bus most definitely calls more than those, so you must never use it in 
the signal handler.

What's more, it's also not reentrant in the same thread. What's probably 
happening is that D-Bus had a lock in a connection, then got interrupted, 
reentered, locked again and unlocked, then resumed. At that point, the 
lock was cleared, hence the assertion.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    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: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20090809/f7a5fc21/attachment.pgp 


More information about the dbus mailing list