disappearing messages with dbus_connection_read_write_dispatch & dbus_connection_pop_message

Tim Wuyts Tim.Wuyts at gmail.com
Tue Oct 16 01:47:14 PDT 2007

greetings programs!

I am trying to use the low-level C api to send signals between
processes, and I ran into an annoying problem: some of the messages I
send get lost.

The problem can easily be reproduced by slightly modifying the
dbus_example.c program by Matthew Jonhson

I attached a diff to this email, but in short I modified the code so
that when you use 'send', it will send two short messages, instead of

The 'receive' function is changed so that it uses
dbus_connection_read_write_dispatch with a timeout of -1 (blocking).

What i now see is that the second signal sometimes gets lost, but not
always! (actually,  pop_message gives me a NULL for the second signal)

Q1: Is this a bug, or am I doing something wrong?
Q2: if I replace pop_message with borrow_message (and message_unref
with return_message) , the system works as expected, I never loose a
message. But then I'm a bit worried about memory management: since I
never actually remove the message from the queue, does it ever get

Thanks in advance for your insights.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus_example.c.diff
Type: text/x-patch
Size: 1669 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20071016/41c6e76b/attachment-0001.bin 

More information about the dbus mailing list