Assert in dbus-message @576

Olsson, Ola1 Ola1.Olsson at
Tue Dec 14 03:39:43 PST 2010

Hi again,

> So I suggest you simply upgrade.

My apologizes, but I can't really see how that can solve the problem since I don't agree that Jim got the right answer.

The assert is in cache_or_finalize() @ 576 but as I wrote, the exact same assert is also present in the beginning of the function, however, we have no problem passing that one.

Hence, I don't think this has anything with the atomic instructions as such, my concerns is that we don't hold any lock when running _dbus_atomic_dec() and keep holding it through the call to cache_or_finalize() in the dbus_message_unref() function and there has not been any changes in this code between 1.02 and 1.4.

Do you see my point and concerns? I just want to make sure that we have a problem before I fix it.

Best regards Ola

-----Original Message-----
From: at [ at] On Behalf Of Thiago Macieira
Sent: tisdag den 14 december 2010 12:00
To: dbus at
Subject: Re: Assert in dbus-message @576

Em Terça-feira, 14 de Dezembro de 2010, às 08:39:46, Olsson, Ola1 escreveu:
> Hi,
> I have exactly the same problem as Jim 
> (
> I am using Android éclair version which has DBus 1.02. I know it is 
> quite
> What is the reason for not having a look when calling to application code?
> Are we afraid of recursion?

That is the case: we are afraid of the user recursing into D-Bus code with locks in place, which would cause deadlocks. Instead, the code is designed so that any calls to user code drop all locks and reacquire when coming back. 
That also means the code must deal with reacquiring the state it had before, which may have changed.

Anyway, the reference counter code has been changed in D-Bus 1.4 to use the GCC built-ins __sync_add_and_fetch and __sync_sub_and_fetch instructions.

I have just tested my ARM compiler (GCC 4.4.1 by CodeSourcery 2010q1) and it handles the built-in just fine. I have also just tested the ARM build of D-Bus
1.4 in Harmattan and I can confirm that the atomic code is being used.

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