View previous topic :: View next topic |
Author |
Message |
brunonieuwenhuys
Joined: 20 Apr 2010 Posts: 5
|
Posted: Fri Aug 12, 2011 2:05 pm Post subject: Dead lock in kh 29 |
|
|
Hello
we can accross a dead lock in KH 29 that is not easy to reproduce.
This is what we managed to find
Thread 19 (Thread 0x7ff881c23700 (LWP 19511)):
#0 0x00007ff87fb8251d in write () from /lib/libc.so.6
#1 0x00007ff8815bf67b in ConnectionManager::write (this=<value optimized out>, socket=1, buf=0x4423d9 "W", length=1) at ./ConnectionManager/ConnectionManager.cpp:219
#2 0x00007ff881742d33 in write (socket=1, buffer=0x4423d9, length=1) at ApiHook/wrap.cpp:240
#3 0x000000000041d2bf in worker_wakeup (worker=0x1854680) at client.c:624
#4 0x00000000004186c8 in source_add_listener (mount=0x7ff86a22c7c0 "/sky_salsa_aacplus", mountinfo=0x36a8e40, client=0x7ff863331490) at source.c:1863
#5 0x000000000042ab14 in add_authenticated_listener (mount=0x7ff86a22c7c0 "/sky_salsa_aacplus", mountinfo=0x36a8e40, client=0x7ff863331490) at auth.c:459
#6 0x000000000042affd in auth_add_listener (mount=0x7ff86a22c7c0 "/sky_salsa_aacplus", client=0x7ff863331490) at auth.c:592
#7 0x000000000040e068 in _handle_get_request (client=0x7ff863331490) at connection.c:1367
#8 0x000000000040cf90 in http_client_request (client=0x7ff863331490) at connection.c:914
#9 0x000000000041cefa in worker (arg=0x1854680) at client.c:528
#10 0x00000000004389b3 in _start_routine (arg=0x1854730) at thread.c:660
#11 0x00007ff87f8939ca in start_thread () from /lib/libpthread.so.0
#12 0x00007ff87fb9070d in clone () from /lib/libc.so.6
#13 0x0000000000000000 in ?? ()
Thread 18 (Thread 0x7ff881ba2700 (LWP 19512)):
#0 0x00007ff87fb8251d in write () from /lib/libc.so.6
#1 0x00007ff8815bf67b in ConnectionManager::write (this=<value optimized out>, socket=1, buf=0x4423d9 "W", length=1) at ./ConnectionManager/ConnectionManager.cpp:219
#2 0x00007ff881742d33 in write (socket=1, buffer=0x4423d9, length=1) at ApiHook/wrap.cpp:240
#3 0x000000000041d2bf in worker_wakeup (worker=0x1854680) at client.c:624
#4 0x000000000041c8f7 in client_change_worker (client=0x509e950, dest_worker=0x1854680) at client.c:361
#5 0x0000000000418e26 in listener_change_worker (client=0x509e950, source=0x7ff868019e90) at source.c:2032
#6 0x00000000004157ba in send_listener (source=0x7ff868019e90, client=0x509e950) at source.c:929
#7 0x0000000000415455 in send_to_listener (client=0x509e950) at source.c:848
#8 0x000000000041cefa in worker (arg=0x18548c0) at client.c:528
#9 0x00000000004389b3 in _start_routine (arg=0x1854970) at thread.c:660
#10 0x00007ff87f8939ca in start_thread () from /lib/libpthread.so.0
#11 0x00007ff87fb9070d in clone () from /lib/libc.so.6
#12 0x0000000000000000 in ?? ()
There is some extra lines in the debug that is linked to our debugging tools.
So apparently two threads are writing to the same socket=1 and this deadlocks things
also note that it's locked inside the native write probably a consequence of thread-unsafe access to the socket
And it looks to be more easy to reproduce if POST listener authentication is activated.
I hope all this helps,
If you need any extra information just let me know.
Bruno Nieuwenhuys _________________ www.adswizz.com |
|
Back to top |
|
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Fri Aug 12, 2011 3:57 pm Post subject: |
|
|
not sure where the ConnectionManager stuff comes from as that is not in any kh build, probably a library tie-in. That particular handle is a worker pipe/socket used for immediate wakeups which is why only 1 byte is sent. seems that both a new authenticated listener and a listener who is moving between workers is waking up the same worker and that is the race.
From what I can tell this is allowed from a thread safety point of view, there's no order requirement for this use, it's just used to wake up a thread, maybe pwrite would suffice. What does this plug-in code provide in this case, is it for SQL logging?, if so then you really could do with avoid it for worker handles.
karl. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group subRebel style by ktauber
|