Posted: Wed Mar 21, 2007 4:09 pm Post subject: [asterisk-dev] Possible deadlock situation in chan_sip.c?
Hi!
Can this code section from chan_sip.c (begin at line 14920) cause deadlocks if any error occurs between the mutex lock for iflock?
--- snip ---
/* Check for interfaces needing to be killed */
ast_mutex_lock(&iflock);
restartsearch:
t = time(NULL);
/* don't scan the interface list if it hasn't been a reasonable period
of time since the last time we did it (when MWI is being sent, we can
get back to this point every millisecond or less)
*/
for (sip = iflist; !fastrestart && sip; sip = sip->next) {
…
}
ast_mutex_unlock(&iflock);
--- snip ---
Asterisk log:
--- snip ---
[Mar 16 12:31:18] ERROR[11927] /usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: chan_sip.c line 4303 (sip_alloc): Deadlock? waited 5 sec for mutex '
&iflock'?
[Mar 16 12:31:18] ERROR[11927] /usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: chan_sip.c line 14920 (do_monitor): '&iflock' was locked here.
[Mar 16 12:31:18] ERROR[11942] /usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: pbx.c line 2105 (ast_extension_state_del): Deadlock? waited 5 sec fo
r mutex '&(&hints)->lock'?
[Mar 16 12:31:18] ERROR[11942] /usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: pbx.c line 1982 (ast_hint_state_changed): '&(&hints)->lock' was lock
ed here.
[Mar 16 12:31:18] ERROR[11927] /usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: chan_sip.c line 4303 (sip_alloc): Deadlock? waited 5 sec for mutex '
&iflock'?
[Mar 16 12:31:18] ERROR[11927] /usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: chan_sip.c line 14920 (do_monitor): '&iflock' was locked here.
[Mar 16 12:31:18] ERROR[11942] /usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: pbx.c line 2105 (ast_extension_state_del): Deadlock? waited 5 sec fo
r mutex '&(&hints)->lock'?
[Mar 16 12:31:18] ERROR[11942] /usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: pbx.c line 1982 (ast_hint_state_changed): '&(&hints)->lock' was lock
ed here.
[Mar 16 12:31:18] ERROR[11927] /usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: chan_sip.c line 4303 (sip_alloc): Deadlock? waited 5 sec for mutex '
&iflock'?
[Mar 16 12:31:18] ERROR[11927] /usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: chan_sip.c line 14920 (do_monitor): '&iflock' was locked here.
[Mar 16 12:31:18] ERROR[11942] /usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: pbx.c line 2105 (ast_extension_state_del): Deadlock? waited 5 sec fo
r mutex '&(&hints)->lock'?
[Mar 16 12:31:18] ERROR[11942] /usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: pbx.c line 1982 (ast_hint_state_changed): '&(&hints)->lock' was lock
ed here.
--- snip ---
Posted: Thu Mar 22, 2007 12:32 am Post subject: [asterisk-dev] Possible deadlock situation in chan_sip.c?
Harald Raetscher wrote:
Quote:
Can this code section from chan_sip.c (begin at line 14920) cause
deadlocks if any error occurs between the mutex lock for iflock?
What do you mean by 'any error'? Is there code in that for loop that can
cause the function to be existed without releasing the lock? If not,
there is no path through the function that would not end up releasing
the lock.
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --
Posted: Thu Mar 22, 2007 3:14 pm Post subject: [asterisk-dev] Possible deadlock situation in chan_sip.c?
Harald, the error says that chan_sip is waiting for the lock, the
deadlock is probably in other unkown place in the code.
On 3/22/07, Harald Raetscher <hra@teamware-gmbh.de> wrote:
Quote:
I don't know if the code in the for loop can break, but how is it
possible that the iflock hasn't been released. The log that I've already
posted points to this situation, right?
Again:
[Mar 16 12:31:18] ERROR[11927]
/usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: chan_sip.c
line 4303 (sip_alloc): Deadlock? waited 5 sec for mutex '&iflock'?
[Mar 16 12:31:18] ERROR[11927]
/usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: chan_sip.c
line 14920 (do_monitor): '&iflock' was locked here.
[Mar 16 12:31:18] ERROR[11942]
/usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: pbx.c line
2105 (ast_extension_state_del): Deadlock? waited 5 sec for mutex
'&(&hints)->lock'?
[Mar 16 12:31:18] ERROR[11942]
/usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: pbx.c line
1982 (ast_hint_state_changed): '&(&hints)->lock' was locked here.
[Mar 16 12:31:18] ERROR[11927]
/usr/src/asterisk/asterisk-1.4.1/include/asterisk/lock.h: chan_sip.c
line 4303 (sip_alloc): Deadlock? waited 5 sec for mutex '&iflock'?
...
Regards,
Harald Rätscher
Harald Raetscher wrote:
> Can this code section from chan_sip.c (begin at line 14920) cause
> deadlocks if any error occurs between the mutex lock for iflock?
What do you mean by 'any error'? Is there code in that for loop that can
cause the function to be existed without releasing the lock? If not,
there is no path through the function that would not end up releasing
the lock.
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --
--
"Su nombre es GNU/Linux, no solamente Linux, mas info en http://www.gnu.org"
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --
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