[Asterisk-Users] Deadlocks in 1.2.7.1

Philipp Ott philipp.ott at avalon.at
Wed May 17 04:05:37 MST 2006


Hello!

Unfortunately we are seeing lately (2-3 times during a day) that  
asterisk seems to hang up somehow - no new calls can be made and sip  
show peers and other commands show no obvious problem.  We then  
recompiled 1.2.7.1 with all the DEBUG_ turned on in the makefile and  
now we see the following messages:

May 17 06:46:05 ERROR[8606]: ../include/asterisk/lock.h:236  
__ast_pthread_mutex_lock: chan_sip.c line 3116 (sip_alloc): Deadlock?  
waited 460 sec for mutex '&iflock'?
May 17 06:46:05 ERROR[8606]: ../include/asterisk/lock.h:239  
__ast_pthread_mutex_lock: chan_sip.c line 11257 (do_monitor):  
'&iflock' was locked here.
May 17 06:46:05 ERROR[8625]: include/asterisk/lock.h:236  
__ast_pthread_mutex_lock: pbx.c line 2017 (ast_extension_state_del):  
Deadlock? waited 460 sec for mutex '&hintlock'?
May 17 06:46:05 ERROR[8625]: include/asterisk/lock.h:239  
__ast_pthread_mutex_lock: pbx.c line 1892 (ast_hint_state_changed):  
'&hintlock' was locked here.
May 17 06:46:05 ERROR[8606]: ../include/asterisk/lock.h:236  
__ast_pthread_mutex_lock: chan_sip.c line 3116 (sip_alloc): Deadlock?  
waited 460 sec for mutex '&iflock'?
May 17 06:46:05 ERROR[8606]: ../include/asterisk/lock.h:239  
__ast_pthread_mutex_lock: chan_sip.c line 11257 (do_monitor):  
'&iflock' was locked here.
May 17 06:46:05 ERROR[8625]: include/asterisk/lock.h:236  
__ast_pthread_mutex_lock: pbx.c line 2017 (ast_extension_state_del):  
Deadlock? waited 460 sec for mutex '&hintlock'?
May 17 06:46:05 ERROR[8625]: include/asterisk/lock.h:239  
__ast_pthread_mutex_lock: pbx.c line 1892 (ast_hint_state_changed):  
'&hintlock' was locked here.
May 17 06:46:05 ERROR[8606]: ../include/asterisk/lock.h:236  
__ast_pthread_mutex_lock: chan_sip.c line 3116 (sip_alloc): Deadlock?  
waited 460 sec for mutex '&iflock'?
May 17 06:46:05 ERROR[8606]: ../include/asterisk/lock.h:239  
__ast_pthread_mutex_lock: chan_sip.c line 11257 (do_monitor):  
'&iflock' was locked here.
May 17 06:46:05 ERROR[8625]: include/asterisk/lock.h:236  
__ast_pthread_mutex_lock: pbx.c line 2017 (ast_extension_state_del):  
Deadlock? waited 460 sec for mutex '&hintlock'?
May 17 06:46:05 ERROR[8625]: include/asterisk/lock.h:239  
__ast_pthread_mutex_lock: pbx.c line 1892 (ast_hint_state_changed):  
'&hintlock' was locked here.
May 17 06:46:05 ERROR[8606]: ../include/asterisk/lock.h:236  
__ast_pthread_mutex_lock: chan_sip.c line 3116 (sip_alloc): Deadlock?  
waited 460 sec for mutex '&iflock'?
May 17 06:46:05 ERROR[8606]: ../include/asterisk/lock.h:239  
__ast_pthread_mutex_lock: chan_sip.c line 11257 (do_monitor):  
'&iflock' was locked here.

This continues until someone stops asterisks and restarts it.

I googled around and found some asterisk deadlock problems but not  
refering to iflock or hintlock.

I glanced through the source looking for mutex_(un)locks iflock and  
found them in pairs, however sometimes some a screen page apart.

We dont use any hardware in the machine and the "partners" for the  
asterisk server are a couple of VoiP phones, a handful "sub" asterisk  
on other machines and a Cisco 5300 for the PSTN gateway.

Philosophy: Dont you want to get rid of the threads and therefore  
mutex-problems? I once wrote a sort-of-asterisk for NMS AG cards and  
used threads as well and saw similar problems, and since I rewrote  
the whole project to a single threaded event-state machine it never  
crashed or hung anymore aside from 0-strcpy-memory access :-) Second  
I remember that malloc() in 2 different threads (kernel 2.4.20)  
returned the same memory pointer - so I had to encapsulate malloc()  
with a mutex_lock/unlock too.

Any clues why this possible deadlock happens?

Regards
Philipp Ott




More information about the asterisk-users mailing list