[Home]

Summary:ASTERISK-11066: Deadlock? when briging calls on PRI device after sometime
Reporter:bugi (bugi)Labels:
Date Opened:2007-12-17 12:04:32.000-0600Date Closed:2007-12-20 14:13:07.000-0600
Priority:BlockerRegression?No
Status:Closed/CompleteComponents:Channels/chan_zap
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) gdb_threads.txt
( 1) show_locks.txt.txt
Description:Hi, i tried to bridge calls on asterisk on Sangoma PRI 104 (wanpipe 3.2.1). After sometime (1,2 or 6 hours) asterisk blocks with message:
[Dec 17 18:34:15] ERROR[20837]: /usr/src/asterisk-1.4.15/include/asterisk/lock.h:338 __ast_pthread_mutex_lock: pbx.c line 5862 (pbx_builtin_setvar_helper): Deadlock? waited 5 sec for mutex '&chan->lock'?
[Dec 17 18:34:15] ERROR[20837]: /usr/src/asterisk-1.4.15/include/asterisk/lock.h:342 __ast_pthread_mutex_lock: channel.c line 2194 (__ast_read): '&chan->lock' was locked here.
[Dec 17 18:34:15] ERROR[20846]: /usr/src/asterisk-1.4.15/include/asterisk/lock.h:338 __ast_pthread_mutex_lock: chan_zap.c line 4628 (zt_read): Deadlock? waited 5 sec for mutex '&p->lock'?
[Dec 17 18:34:15] ERROR[20846]: /usr/src/asterisk-1.4.15/include/asterisk/lock.h:342 __ast_pthread_mutex_lock: chan_zap.c line 8683 (pri_dchannel): '&p->lock' was locked here.
[Dec 17 18:34:15] ERROR[21637]: /usr/src/asterisk-1.4.15/include/asterisk/lock.h:338 __ast_pthread_mutex_lock: pbx.c line 1138 (pbx_retrieve_variable): Deadlock? waited 5 sec for mutex '&c->lock'?
[Dec 17 18:34:15] ERROR[21637]: /usr/src/asterisk-1.4.15/include/asterisk/lock.h:342 __ast_pthread_mutex_lock: channel.c line 2194 (__ast_read): '&c->lock' was locked here.
[Dec 17 18:34:15] ERROR[20837]: /usr/src/asterisk-1.4.15/include/asterisk/lock.h:338 __ast_pthread_mutex_lock: pbx.c line 5862 (pbx_builtin_setvar_helper): Deadlock? waited 5 sec for mutex '&chan->lock'?
[Dec 17 18:34:15] ERROR[20837]: /usr/src/asterisk-1.4.15/include/asterisk/lock.h:342 __ast_pthread_mutex_lock: channel.c line 2194 (__ast_read): '&chan->lock' was locked here.

I tried to compile asterisk on different distros and machines and this problem still occur.

My extensions.conf:
[from-pstn]
exten => _X.,1,Dial(Zap/g1/${EXTEN})
exten => _X.,n,Hangup
Comments:By: Russell Bryant (russell) 2007-12-17 14:45:28.000-0600

please compile with DEBUG_THREADS enabled.  Then, when this occurs, grab the output of "core show locks".  Post it here.

$ sudo asterisk -rx "core show locks" > show_locks.txt

By: bugi (bugi) 2007-12-17 15:10:57.000-0600

i tried but "/usr/sbin/safe_asterisk: line 117: 25832 Segmentation fault      (core dumped) nice -n $PRIORITY ${ASTSBINDIR}/asterisk -f ${CLIARGS} ${ASTARGS} >&/dev/${TTY} </dev/${TTY}"

maybe i can debug this core i put here results ?

EDIT: I added few threads which I grabed from core via gdb



By: bugi (bugi) 2007-12-20 05:09:49.000-0600

I upgrade asterisk to fresh version 1.14.16.1, there is the same problem. But now i attach a view from 'core show locks' cli command.

By: Digium Subversion (svnbot) 2007-12-20 14:05:31.000-0600

Repository: asterisk
Revision: 94251

U   branches/1.4/channels/chan_zap.c

------------------------------------------------------------------------
r94251 | russell | 2007-12-20 14:05:29 -0600 (Thu, 20 Dec 2007) | 10 lines

Fix a deadlock in d-channel handling in chan_zap.

This deadlock was introduced by the fix to ensure that channels are properly
locked when handling channel variables.  There were sections of this code where
the channel pvt was locked before the channel lock, when in fact it _must_ be
the other way around.

(closes issue ASTERISK-11066)
Reported by: bugi

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=94251

By: Russell Bryant (russell) 2007-12-20 14:07:37.000-0600

This bug fix was brought to you by Digium, Inc.  I hope you'll consider that the next time you go to purchase a PRI card.  :)

By: Digium Subversion (svnbot) 2007-12-20 14:13:07.000-0600

Repository: asterisk
Revision: 94252

_U  trunk/
U   trunk/channels/chan_zap.c

------------------------------------------------------------------------
r94252 | russell | 2007-12-20 14:13:07 -0600 (Thu, 20 Dec 2007) | 18 lines

Merged revisions 94251 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r94251 | russell | 2007-12-20 14:08:42 -0600 (Thu, 20 Dec 2007) | 10 lines

Fix a deadlock in d-channel handling in chan_zap.

This deadlock was introduced by the fix to ensure that channels are properly
locked when handling channel variables.  There were sections of this code where
the channel pvt was locked before the channel lock, when in fact it _must_ be
the other way around.

(closes issue ASTERISK-11066)
Reported by: bugi

........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=94252