[avahi] DBus issues
lennart at poettering.net
Sun Aug 31 14:17:34 PDT 2008
On Sun, 31.08.08 21:54, Stefan de Konink (avahi at ml.kinkrsoftware.nl) wrote:
> > avahi-client properly closes the D-Bus connection before unrefing it,
> > it should be as robust as a C program can be. (see avahi_client_free()
> > in avahi-client/client.c:612)
> > If you are encountering this problem it is most likely some kind of
> > programming error elsewhere, maybe you call avahi_client_free() more
> > than once on the same object?
> > Valgrind might help you find this misuse.
> (gdb) bt
> #0 0x00002b527abd8f6f in _dbus_marshal_read_basic () from
> #1 0x00002b527abc78dc in _dbus_header_get_field_basic () from
> #2 0x00002b527abcbc77 in dbus_message_get_reply_serial () from
> #3 0x00002b527abc5d25 in _dbus_connection_queue_received_message_link
> () from /usr/lib/libdbus-1.so.3
> #4 0x00002b527abd4f41 in _dbus_transport_queue_messages () from
> #5 0x00002b527abd5ca5 in do_reading () from /usr/lib/libdbus-1.so.3
> #6 0x00002b527abd623f in socket_handle_watch () from
> #7 0x00002b527abd4a66 in _dbus_transport_handle_watch () from
> #8 0x00002b527abc5ce1 in _dbus_connection_handle_watch () from
> #9 0x00002b527abd68a2 in dbus_watch_handle () from /usr/lib/libdbus-1.so.3
> #10 0x00002b527adf63cb in avahi_simple_poll_dispatch (s=0x67ac30) at
> #11 0x00002b527adf692d in avahi_simple_poll_loop (s=0x67ac30) at
> #12 0x00002b527adf72ce in thread (userdata=0x67abe0) at thread-watch.c:73
> #13 0x00002b52784ce067 in start_thread () from /lib/libpthread.so.0
> #14 0x00002b5278ceabdd in clone () from /lib/libc.so.6
> #15 0x0000000000000000 in ?? ()
> I am not able to reproduce it inside valgrind again, but the above trace
> doesn't really show my code ;)
Ah, so your are using the threaded event loop. This smells a lot like
that you have some locking issues here: maybe you forgot to enclose
code accessing the avahi client object in _lock() and _unlock()?
Please note that avahi is not thread-safe. However, it is
threads-aware. i.e. it works fine in a threaded environment as long as
you following the locking rules properly.
The thing about bad memory accesses like this is that the problems
usually show up at places where you don't expect.
Lennart Poettering Red Hat, Inc.
lennart [at] poettering [dot] net ICQ# 11060553
http://0pointer.net/lennart/ GnuPG 0x1A015CC4
More information about the avahi