[asterisk-dev] DEBUG_THREADS and unreleased locks

Norman Franke norman at myasd.com
Thu Jan 31 17:41:51 CST 2008


I've compiled Asterisk 1.4.17 with DEBUG_CHANNEL_LOCKS,  
DEBUG_THREADS, DETECT_DEADLOCKS, DONT_OPTIMIZE and MALLOC_DEBUG.  
After running for some time, I noticed this. It's happened several  
times. I do have a custom-developed app for call direction.

=== Thread ID: 3061398448 (do_monitor           started at [15638]  
chan_sip.c restart_monitor())
=== ---> Tried and failed to get Lock #0 (channel.c): MUTEX 5012  
ast_channel_trylock &chan->lock 0xb6b7cee8 (4)
=== ---> Lock #1 (channel.c): MUTEX 5012 ast_channel_trylock &chan- 
 >lock 0xb50032c0 (1)

I generally think I can ignore the "tried and failed", but it thinks  
it's holding a lock (and for hours.) There are no active channels  
"core show channels" gives 0 active. "sip show channels" also has  
nothing. chan_sip.c:do_monitor seems to only get a channel lock in  
one place, and I can't see how it can exit without unlocking it.

First, what happens to LOG_DEBUG messages?

Placing a breakpoint in ast_channel_trylock, I get this:

#0  ast_channel_trylock (chan=0xb502a7a0) at channel.c:5009
#1  0xb67ddf2f in sipsock_read (id=0x82b0310, fd=17, events=1,  
ignore=0x0) at chan_sip.c:15344
#2  0x080ba8e7 in ast_io_wait (ioc=0x82a3728, howlong=1) at io.c:279
#3  0xb67ded49 in do_monitor (data=0x0) at chan_sip.c:15579
#4  0x08117762 in dummy_start (data=0x82afc38) at utils.c:857
#5  0xb7f30240 in start_thread () from /lib/tls/i686/cmov/ 
libpthread.so.0
#6  0xb701f49e in clone () from /lib/tls/i686/cmov/libc.so.6

So sipsock_read is doing the locking, I'd guess. But that all seems OK.

I also noticed one instance of this:

[Jan 31 16:19:36] ERROR[19715]: chan_sip.c:15360 sipsock_read: We  
could NOT get the channel lock for SIP/station026-b5024440!
[Jan 31 16:19:36] ERROR[19715]: chan_sip.c:15361 sipsock_read: SIP  
transaction failed: 5cd800000cbd000041a7

Could that cause it?

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20080131/e4707fab/attachment.htm 


More information about the asterisk-dev mailing list