Failing example program to send and receive dbus messages

Jonne Zutt j.zutt at tudelft.nl
Wed May 2 06:52:33 PDT 2007


Here is an example program that should be able to send and receive
dbus messages at the same time (using glib).
-> connector.cc [ http://cpp.sourceforge.net/?show=35316 ]
-> DbusConnection-glue.hh [ http://cpp.sourceforge.net/?show=35317 ]

Our problem is that after receiving some messages, the first attempt to
send a message results in a segfault.

The stacktrace is not always the same, see the bottom of this email for
an example trace.

 - To compile:
        g++ connector.cc -o connector -pthread `pkg-config --libs
--cflags
dbus-glib-1`
 - Start first instance:
        ./connector some.a some.b
 - Start second instance:
        ./connector some.b some.a

Thanks in advance,
Jonne.

(gdb) r
Starting program: /tmp/connector some.b some.a
[Thread debugging using libthread_db enabled]
[New Thread -1208268576 (LWP 19340)]
me some.b, he some.a
[New Thread -1208271984 (LWP 19343)]
Dbus receive thread starts glib-mainloop.
Received: String-0
Received: String-1
Received: String-2
Received: String-3
Received: String-4
Received: String-5
Received: String-6
Received: String-7
Received: String-8
Received: String-9
Received: String-10
Received: String-11
Received: String-12
Received: String-13
Received: String-14
Received: String-15
Received: String-16
Received: String-17
Received: String-18
Received: String-19
Received: String-20
Sending: String-0

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208268576 (LWP 19340)]
0x0032b3d6 in dbus_internal_do_not_use_get_uuid ()
from /lib/libdbus-1.so.3
(gdb) bt
#0  0x0032b3d6 in dbus_internal_do_not_use_get_uuid ()
from /lib/libdbus-1.so.3
#1  0x0032adfa in dbus_threads_init () from /lib/libdbus-1.so.3
#2  0x0032ae71 in dbus_threads_init () from /lib/libdbus-1.so.3
#3  0x00329029 in dbus_threads_init () from /lib/libdbus-1.so.3
#4  0x0032987e in dbus_threads_init () from /lib/libdbus-1.so.3
#5  0x003154f4 in dbus_connection_set_watch_functions ()
from /lib/libdbus-1.so.3
#6  0x003170cd in dbus_connection_open () from /lib/libdbus-1.so.3
#7  0x0031721c in dbus_connection_open () from /lib/libdbus-1.so.3
#8  0x003234d1 in dbus_pending_call_block () from /lib/libdbus-1.so.3
#9  0x00d449d8 in dbus_g_proxy_cancel_call ()
from /usr/lib/libdbus-glib-1.so.2
#10 0x00d48a49 in dbus_g_proxy_call () from /usr/lib/libdbus-glib-1.so.2
#11 0x08049545 in sendDBUS (msg=@0xbffda448) at connector.cc:133
#12 0x0804998a in main (argc=3, argv=0xbffda4f4) at connector.cc:161




More information about the dbus mailing list