The scenario –

Thread B tries to delete an event E for which a callback is executed by thread 
A. The callback calls event_base_gettimeofday_cached() that acquires 
th_base_lock:



Thread A (LWP 14625 in the stack/strace below) locks *current_event_lock* 
before invokoing callback.

Thread B (LWP 14585 in the stack/strace below) locks *th_base_lock* inside 
method event_del.

Thread B *blocks* on *current_event_lock* inside event_del_internal.

Thread A *blocks* on *th_base_lock* inside event_base_gettimeofday_cached.







(gdb) thread 6

[Switching to thread 6 (Thread 1346476352 (LWP 14625))]#0  0x000000364460c758 
in __lll_mutex_lock_wait () from /lib64/libpthread.so.0

(gdb) where

#0  0x000000364460c758 in __lll_mutex_lock_wait () from /lib64/libpthread.so.0

#1  0x00000036446087fa in _L_mutex_lock_908 () from /lib64/libpthread.so.0

#2  0x0000003644608682 in pthread_mutex_lock () from /lib64/libpthread.so.0

#3  0x00002aaab035e989 in event_base_gettimeofday_cached () from 
/opt/breach/bwd/lib/libevent_core.so.4

#4  0x00002aaaae955017 in CBTcpProxyReceiverThread::SetPxcnTimeStamp 
(this=0x23fcbb10, side=SIDE_CLIENT, p_pxcn=0x30e0db90)

    at receiver_thread.cpp:174

#5  0x00002aaaae955084 in receiver_cb (fd=105, what=34, arg=0x30e0db90) at 
receiver_thread.cpp:189

#6  0x00002aaab03613c9 in event_base_loop () from 
/opt/breach/bwd/lib/libevent_core.so.4

#7  0x00002aaaae955638 in CBTcpProxyReceiverThread::run (this=0x23fcbb10) at 
receiver_thread.cpp:42

#8  0x00002aaaae2f86c2 in JTCThread::entrance_hook (this=0x23fcbb10) at 
Thread.cpp:1049

#9  0x00002aaaae2faf2f in lsf_thread_adapter (arg=0x23fcbb10) at Thread.cpp:174 
#10 0x00000036446061b5 in start_thread () from /lib64/libpthread.so.0

#11 0x0000003643acd36d in clone () from /lib64/libc.so.6

#12 0x0000000000000000 in ?? ()



[r...@set8-64bit bwd]# strace -p 14625

Process 14625 attached - interrupt to quit futex(0x23fcc1b0, FUTEX_WAIT, 2, 
NULL <unfinished ...>





(gdb) thread 18

[Switching to thread 18 (Thread 1220598080 (LWP 14585))]#0  0x000000364460c758 
in __lll_mutex_lock_wait () from /lib64/libpthread.so.0

(gdb) where

#0  0x000000364460c758 in __lll_mutex_lock_wait () from /lib64/libpthread.so.0

#1  0x00000036446087fa in _L_mutex_lock_908 () from /lib64/libpthread.so.0

#2  0x0000003644608682 in pthread_mutex_lock () from /lib64/libpthread.so.0

#3  0x00002aaab0362123 in event_del () from 
/opt/breach/bwd/lib/libevent_core.so.4

#4  0x00002aaaae9577a0 in CBTcpProxy::ShutDownRe (this=0x1cf2eb58, 
px...@0x30e0db90, side=SIDE_CLIENT) at tcpproxy.cpp:450

#5  0x00002aaaae958834 in CBTcpProxy::ClosePXCN (this=0x1cf2eb58, 
px...@0x30e0db90, closing_peer=SIDE_CLIENT) at tcpproxy.cpp:378

#6  0x00002aaaaac12546 in CGSnfHandler::ResetSession (this=0x2aaab898abd0) at 
g_snf_handler.cpp:633

#7  0x00002aaaaac0feef in CGSnfHandler::HandleSession (this=0x2aaab898abd0) at 
g_snf_handler.cpp:1203

#8  0x00002aaaaac10c6d in CGSnfHandler::OnRun (this=0x2aaab898abd0) at 
g_snf_handler.cpp:840

#9  0x00002aaaaac6d2f3 in CProtocolHandlerTh::run (this=0x2aaab88f4930) at 
protocolhandler.cpp:281 #10 0x00002aaaae2f86c2 in JTCThread::entrance_hook 
(this=0x2aaab88f4930) at Thread.cpp:1049

#11 0x00002aaaae2faf2f in lsf_thread_adapter (arg=0x2aaab88f4930) at 
Thread.cpp:174

#12 0x00000036446061b5 in start_thread () from /lib64/libpthread.so.0

#13 0x0000003643acd36d in clone () from /lib64/libc.so.6

#14 0x0000000000000000 in ?? ()



[r...@set8-64bit]# strace -p 14585

Process 14585 attached - interrupt to quit futex(0x23fcc1e0, FUTEX_WAIT, 2, 
NULL <unfinished ...>





Avi

***********************************************************************
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-users    in the body.

Reply via email to