_doMonitor线程中,重复加同一个锁,引起死锁。
[root@localhostroot]# gdb attach 131081
(gdb) infothreads
26Thread 540697 (LWP 30861) 0x00c40094 in__pthread_sigsuspend () from /lib/i686/libpthread.so.0
25Thread 393240 (LWP 29644) 0x00c40094 in__pthread_sigsuspend () from /lib/i686/libpthread.so.0
24Thread 376855 (LWP 29643) 0x0055d266 innanosleep () from /lib/i686/libc.so.6
23Thread 360470 (LWP 29642) 0x0055d266 innanosleep () from /lib/i686/libc.so.6
22Thread 344085 (LWP 29641) 0x0055d266 innanosleep () from /lib/i686/libc.so.6
21Thread 327700 (LWP 29640) 0x0055d266 innanosleep () from /lib/i686/libc.so.6
20Thread 311315 (LWP 29639) 0x0058a481 inselect () from /lib/i686/libc.so.6
19Thread 294930 (LWP 29638) 0x0058a481 inselect () from /lib/i686/libc.so.6
18Thread 278545 (LWP 29637) 0x0055d266 innanosleep () from /lib/i686/libc.so.6
17Thread 262160 (LWP 29636) 0x0055d266 innanosleep () from /lib/i686/libc.so.6
16Thread 245775 (LWP 29635) 0x0055d266 innanosleep () from /lib/i686/libc.so.6
15Thread 213006 (LWP 29615) 0x0058a481 inselect () from /lib/i686/libc.so.6
14Thread 229389 (LWP 29633) 0x00c4330b inread () from /lib/i686/libpthread.so.0
13Thread 180236 (LWP 29573) 0x00c4330b inread () from /lib/i686/libpthread.so.0
12Thread 163851 (LWP 29533) 0x0055d266 innanosleep () from /lib/i686/libc.so.6
11Thread 147466 (LWP 29532) 0x00c40094 in__pthread_sigsuspend () from /lib/i686/libpthread.so.0
10Thread 131081 (LWP 29531) 0x0055d266 innanosleep () from /lib/i686/libc.so.6
9Thread 114696 (LWP 29530) 0x0058a481 inselect () from /lib/i686/libc.so.6
8Thread 98311 (LWP 29529) 0x0055d266 innanosleep () from /lib/i686/libc.so.6
7Thread 81926 (LWP 29524) 0x0055d266 innanosleep () from /lib/i686/libc.so.6
6Thread 65541 (LWP 29522) 0x0058a481 inselect () from /lib/i686/libc.so.6
5Thread 49156 (LWP 29511) 0x00c43508 inaccept () from /lib/i686/libpthread.so.0
4Thread 32771 (LWP 29510) 0x0055d266 innanosleep () from /lib/i686/libc.so.6
3Thread 16386 (LWP 29509) 0x00c43508 inaccept () from /lib/i686/libpthread.so.0
2 Thread 32769 (LWP 29508) 0x00587fca in poll () from/lib/i686/libc.so.6
1Thread 16384 (LWP 29507) 0x0058a481 inselect () from /lib/i686/libc.so.6
(gdb) t 26
[Switching to thread 26 (Thread 540697 (LWP30861))]#0 0x00c40094 in__pthread_sigsuspend () from /lib/i686/libpthread.so.0
(gdb) bt
#0 0x00c40094 in __pthread_sigsuspend () from /lib/i686/libpthread.so.0
#1 0x00c3fa28 in __pthread_wait_for_restart_signal () from /lib/i686/libpthread.so.0
#2 0x00c41620 in __pthread_alt_lock () from/lib/i686/libpthread.so.0
#3 0x00c3e2b7 in pthread_mutex_lock () from /lib/i686/libpthread.so.0
#4 0x081230e5 in LogTrunkStatus (fd=30) atsrc/sipCli.c:632
#5 0x08123382 in GUILogTrunkStatus (fd=30, argc=1, argv=0x6b39a90) atsrc/sipCli.c:700
#6 0x0807338a in CmdHandler (fd=30, s=0x6b39bd0"log-iptrunk-status") at src/command.c:568
#7 0x0807c7e9 in _clientConsoleHandler (p_console=0x831b2c0) atsrc/console.c:690
#8 0x00c3de21 in pthread_start_thread () from/lib/i686/libpthread.so.0
#9 0x0059109a in clone () from /lib/i686/libc.so.6
(gdb) t 25
[Switching to thread 25 (Thread 393240 (LWP29644))]#0 0x00c40094 in__pthread_sigsuspend () from /lib/i686/libpthread.so.0
(gdb) bt
#0 0x00c40094 in __pthread_sigsuspend () from /lib/i686/libpthread.so.0
#1 0x00c3fa28 in __pthread_wait_for_restart_signal () from/lib/i686/libpthread.so.0
#2 0x00c41620 in __pthread_alt_lock () from/lib/i686/libpthread.so.0
#3 0x00c3e2b7 in pthread_mutex_lock () from /lib/i686/libpthread.so.0
#4 0x08124808 in sbc_switch () atsrc/sipCli.c:1250
#5 0x00c3de21 in pthread_start_thread () from /lib/i686/libpthread.so.0
#6 0x0059109a in clone () from /lib/i686/libc.so.6
(gdb) t 11
[Switching to thread 11 (Thread 147466 (LWP29532))]#0 0x00c40094 in__pthread_sigsuspend () from /lib/i686/libpthread.so.0
(gdb) bt
#0 0x00c40094 in __pthread_sigsuspend () from /lib/i686/libpthread.so.0
#1 0x00c3fa28 in __pthread_wait_for_restart_signal () from/lib/i686/libpthread.so.0
#2 0x00c41620 in __pthread_alt_lock () from/lib/i686/libpthread.so.0
#3 0x00c3e2b7 in pthread_mutex_lock () from /lib/i686/libpthread.so.0
#4 0x0812a0a6 in GetLocalInfoFromCalleeList (p_name_ptr=0x869f354"trunk70", p_myId_ptr=0x90aee50 "", p_mySecret_ptr=0x90aee00"4\026") at src/sipUtil.c:280
#5 0x08125756 in _formAuthData (p=0x869f230, req=0x869f3f4,header=0x8244617 "Authorization", orig_header=0x8243bf1"REGISTER", digest=0x90af700 "", digest_len=512, side=1)
at src/sipAuth.c:280
#6 0x0810c90b in _sipSendRegisterToIpFarEnd (callee=0x869c740, ocseq=4) atsrc/sipCC.c:7231
#7 0x0810da0c in _doMonitor (data=0x0) atsrc/sipCC.c:7785
#8 0x00c3de21 in pthread_start_thread () from /lib/i686/libpthread.so.0
#9 0x0059109a in clone () from /lib/i686/libc.so.6
(gdb)
[root@asg ~]# gdb attach 31230
GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-37.el5)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".
For bug reporting instructions, please see:
...
attach: No such file or directory.
Attaching to process 31230
Reading symbols from /var/wangww/relay.update/call_contr/voip...done.
Reading symbols from /lib/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
[New Thread 0xaedffb90 (LWP 31240)]
[New Thread 0xaf800b90 (LWP 31239)]
[New Thread 0xb0201b90 (LWP 31238)]
[New Thread 0xb0c02b90 (LWP 31237)]
[New Thread 0xb1603b90 (LWP 31236)]
[New Thread 0xb2004b90 (LWP 31235)]
[New Thread 0xb2a05b90 (LWP 31234)]
[New Thread 0xb3406b90 (LWP 31233)]
[New Thread 0xb3e07b90 (LWP 31232)]
[New Thread 0xb4808b90 (LWP 31231)]
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
0x0011c402 in __kernel_vsyscall ()
(gdb) bt
#0 0x0011c402 in __kernel_vsyscall ()
#1 0x00d35739 in __lll_lock_wait () from /lib/libpthread.so.0
#2 0x00d30d9f in _L_lock_885 () from /lib/libpthread.so.0
#3 0x00d30c66 in pthread_mutex_lock () from /lib/libpthread.so.0
#4 0x0804a395 in main2relay_add_one_message (pack=0xbfa3a594) at main/src/voip_main.c:8448
#5 0x08056f6b in VoIP_send_to_relay (msg=0xbfa3b884) at main/src/voip_main.c:3291
#6 0x080570c8 in VoIP_send_to_drv (msg=0x80ef8d8) at main/src/voip_main.c:3439
#7 0x080943a9 in MC_process_start_call (mcb=0x9a45940, cc_msg=0xbfa3b9ac) at mc/src/voip_mc.c:1385
#8 0x08094694 in MC_process_tel_msg_from_cc (cc_msg=0xbfa3b9ac) at mc/src/voip_mc.c:637
#9 0x0807bab6 in CC_send_StartCall_to_mc (chan_type=1, chanID=256, len=2, dtmf=0x99a4356 "81") at cc/src/voip_cc.c:4816
#10 0x0808166a in CC_process_fxo_inside_IncomingCall (ccb=0x99a4280, msg=0xac45d08) at cc/src/voip_cc.c:3025
#11 0x08081d39 in CC_process_tel_inside_msg (ccb=0x99a4280, msg=0xac45d08) at cc/src/voip_cc.c:2461
#12 0x08087a3d in CC_poll_inside_msg () at cc/src/voip_cc.c:256
#13 0x0805c056 in main (argc=Cannot access memory at address 0x80
) at main/src/voip_main.c:805
(gdb) info threads
11 Thread 0xb4808b90 (LWP 31231) 0x0011c402 in __kernel_vsyscall ()
10 Thread 0xb3e07b90 (LWP 31232) 0x0011c402 in __kernel_vsyscall ()
9 Thread 0xb3406b90 (LWP 31233) 0x0011c402 in __kernel_vsyscall ()
8 Thread 0xb2a05b90 (LWP 31234) 0x0011c402 in __kernel_vsyscall ()
7 Thread 0xb2004b90 (LWP 31235) 0x0011c402 in __kernel_vsyscall ()
6 Thread 0xb1603b90 (LWP 31236) 0x0011c402 in __kernel_vsyscall ()
5 Thread 0xb0c02b90 (LWP 31237) 0x0011c402 in __kernel_vsyscall ()
4 Thread 0xb0201b90 (LWP 31238) 0x0011c402 in __kernel_vsyscall ()
3 Thread 0xaf800b90 (LWP 31239) 0x0011c402 in __kernel_vsyscall ()
2 Thread 0xaedffb90 (LWP 31240) 0x0011c402 in __kernel_vsyscall ()
* 1 Thread 0xb7f296c0 (LWP 31230) 0x0011c402 in __kernel_vsyscall ()
(gdb) thread 1
[Switching to thread 1 (Thread 0xb7f296c0 (LWP 31230))]#0 0x0011c402 in __kernel_vsyscall ()
(gdb) bt
#0 0x0011c402 in __kernel_vsyscall ()
#1 0x00d35739 in __lll_lock_wait () from /lib/libpthread.so.0
#2 0x00d30d9f in _L_lock_885 () from /lib/libpthread.so.0
#3 0x00d30c66 in pthread_mutex_lock () from /lib/libpthread.so.0
#4 0x0804a395 in main2relay_add_one_message (pack=0xbfa3a594) at main/src/voip_main.c:8448
#5 0x08056f6b in VoIP_send_to_relay (msg=0xbfa3b884) at main/src/voip_main.c:3291
#6 0x080570c8 in VoIP_send_to_drv (msg=0x80ef8d8) at main/src/voip_main.c:3439
#7 0x080943a9 in MC_process_start_call (mcb=0x9a45940, cc_msg=0xbfa3b9ac) at mc/src/voip_mc.c:1385
#8 0x08094694 in MC_process_tel_msg_from_cc (cc_msg=0xbfa3b9ac) at mc/src/voip_mc.c:637
#9 0x0807bab6 in CC_send_StartCall_to_mc (chan_type=1, chanID=256, len=2, dtmf=0x99a4356 "81") at cc/src/voip_cc.c:4816
#10 0x0808166a in CC_process_fxo_inside_IncomingCall (ccb=0x99a4280, msg=0xac45d08) at cc/src/voip_cc.c:3025
#11 0x08081d39 in CC_process_tel_inside_msg (ccb=0x99a4280, msg=0xac45d08) at cc/src/voip_cc.c:2461
#12 0x08087a3d in CC_poll_inside_msg () at cc/src/voip_cc.c:256
#13 0x0805c056 in main (argc=Cannot access memory at address 0x80
) at main/src/voip_main.c:805
(gdb) thread 2
[Switching to thread 2 (Thread 0xaedffb90 (LWP 31240))]#0 0x0011c402 in __kernel_vsyscall ()
(gdb) bt
#0 0x0011c402 in __kernel_vsyscall ()
#1 0x00c2dd26 in nanosleep () from /lib/libc.so.6
#2 0x00c2db4f in sleep () from /lib/libc.so.6
#3 0x08079cd5 in Relay_check_state_thread () at main/src/voip_relay.c:4732
#4 0x00d2e832 in start_thread () from /lib/libpthread.so.0
#5 0x00c6e46e in clone () from /lib/libc.so.6
(gdb) thread 3
[Switching to thread 3 (Thread 0xaf800b90 (LWP 31239))]#0 0x0011c402 in __kernel_vsyscall ()
(gdb) bt
#0 0x0011c402 in __kernel_vsyscall ()
#1 0x00d35739 in __lll_lock_wait () from /lib/libpthread.so.0
#2 0x00d30d9f in _L_lock_885 () from /lib/libpthread.so.0
#3 0x00d30c66 in pthread_mutex_lock () from /lib/libpthread.so.0
#4 0x0804a395 in main2relay_add_one_message (pack=0x8ae81c4) at main/src/voip_main.c:8448
#5 0x08077646 in HandleMsgMain2Relay (pack=0x8ae81c4) at main/src/voip_relay.c:2324
#6 0x080793da in LookupmsgMain2Relay () at main/src/voip_relay.c:3036
#7 0x08079465 in Relay_process_msg_thread () at main/src/voip_relay.c:4310
#8 0x00d2e832 in start_thread () from /lib/libpthread.so.0
#9 0x00c6e46e in clone () from /lib/libc.so.6