[avahi] corrupted double-linked list
gaspard at teti.ch
Fri May 8 15:06:52 PDT 2009
I'm not touching anything from the Implementation class (where the
avahi thread is running) so this does not seem to be the problem.
I also get a "Bad State" error while doing the group entry commit even
though my code path is exactly the same as the example:
create_client ---> client_callback --->
AVAHI_CLIENT_S_RUNNING ? ---> create_services ---> create group
---> add service ---> commit
How can I get a "Bad State" error when the client is running fine and
all creation steps and group setup did not return any error ?
current code: http://github.com/rubyk/rubyk/tree/master/oscit/src/linux
This dump shows the exact path:
#4 0x08123c90 in
#5 0x08123d04 in
(client=0x8d07230, state=AVAHI_CLIENT_S_RUNNING, context=0x8d05080)
#6 0xb806316a in client_set_state (client=0x8d07230,
state=AVAHI_SERVER_RUNNING) at client.c:101
#7 0xb806361f in init_server (client=0x8d07230, ret_error=0xb6d682c4)
#8 0xb8064560 in avahi_client_new (poll_api=0x8d06dc8, flags=0,
AvahiClientState, void*)>, userdata=0x8d05080, ret_error=0xb6d682c4)
#9 0x08123896 in
#10 0x0812394d in Implementation (this=0x8d05080, master=0x8d05048) at
#11 0x0812358d in ZeroConfRegistration (this=0x8d05048,
name=@0xb6d68364, service_type=0x814c883 "_oscit._udp", port=7010)
On Fri, May 8, 2009 at 10:34 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Fri, 08.05.09 09:11, Gaspard Bucher (gaspard at teti.ch) wrote:
>> I cannot seem to get avahi to work in my application. During runtime I get
>> *** glibc detected *** ... corrupted double-linked list
>> This seems to be related to avahi in very strange ways. Has anyone
>> experienced such problems when using avahi ?
>> Any help would be greatly appreciated. I really feel stupid here...
> Uh. I don't really grok that code. Bu uh, you seem not to lock the
> threaded main loop ever. Which gives me the idea that this issue is
> simply a race issue, because of incomplete locking.
> Please note that Avahi is not thread-safe by itself. It offers you a
> few tools to use it in a threaded environment however. But you have to
> do all locking explicitly yourself, Avahi won't do it for you implicitly.
> Basically the idea is that after you started the threaded event loop
> if you need to touch the avahi context in anyway from anothe thread
> you have to lock the event loop first (i.e. temporarily interrupt its
> execution) and then unlock after your access.
> i.e. something like this:
> /* First lock things */
> /* The call Avahi client functions */
> foo = avahi_client_xxx(bar);
> waldo = avahi_service_browser_yyy(humpf);
> /* When you are done, unlock things again */
> This locking logic works very similar to Java monitors if you know
> those. Or it's even a bit like the MT support in the GLib event loop.
> Hope this helps,
> Lennart Poettering Red Hat, Inc.
> lennart [at] poettering [dot] net
> http://0pointer.net/lennart/ GnuPG 0x1A015CC4
> avahi mailing list
> avahi at lists.freedesktop.org
More information about the avahi