crash with async callbacks in dbus-python (incl. small test program)
Olaf Lüke
olaf at tinkerforge.com
Sat Jan 22 18:38:52 PST 2011
Hello,
I finally managed to reproduce the problems i have with my application
in a minimal test program.
If you run the attached service together with two of the clients, the
service will crash with the following remark:
"The last reference on a connection was dropped without closing the
connection. This is a bug in an application. See dbus_connection_unref()
documentation for details.
Most likely, the application was supposed to call
dbus_connection_close(), since this is a private connection."
I also tried to use the the glib mainloop instead of the thread by
adding the callback handler as the idle function. The result is the
same.
So, is this a bug or is it not meant to be used this way?
If the latter is the case, how can i fix it?
In the application the data from the method calls is send to a usb
device and the callback is saved with a message id. One thread
continuously reads data from the usb device, matches the messages with
the correct callback and puts both in a queue. The Queue is processed in
another thread, in the same way as in the attached service.py.
Is there a better way to use dbus in this scenario? I can't just
synchronously wait for an answer from the usb device in the method, that
would take too long.
Cheers,
Olaf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: client.py
Type: text/x-python
Size: 280 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20110123/511921be/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: service.py
Type: text/x-python
Size: 978 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20110123/511921be/attachment-0001.py>
More information about the dbus
mailing list