[asterisk-bugs] [Asterisk 0014639]: Asterisk CPU usage 100% (deadlock?) when using Queue() with Local channels

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Jul 1 20:03:54 CDT 2009


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=14639 
====================================================================== 
Reported By:                coolmig
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   14639
Category:                   Channels/chan_local
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Target Version:             1.4.28
Asterisk Version:           1.4.22 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-03-10 12:26 CDT
Last Modified:              2009-07-01 20:03 CDT
====================================================================== 
Summary:                    Asterisk CPU usage 100% (deadlock?) when using
Queue() with Local channels
Description: 
I was testing a dialer I'm making, and found this situation: when I dial
more than one call to an agent using Local channels (busy with one call and
one or more in the queue), Asterisk goes 100% CPU all the time until the
queued calls get answered or hangup.

Core show locks shows this:

=======================================================================
=== Currently Held Locks ==============================================
=======================================================================
===
=== <file> <line num> <function> <lock name> <lock addr> (times locked)
===
=== Thread ID: 3077847952 (pbx_thread           started at [ 2645] pbx.c
ast_pbx_start())
=== ---> Waiting for Lock https://issues.asterisk.org/view.php?id=0
(chan_agent.c): MUTEX 2252 __login_exec
&p->app_lock 0x93d59d4 (1)
=== --- ---> Locked Here: chan_agent.c line 1080 (agent_new)
=== -------------------------------------------------------------------
===
=== Thread ID: 3073665936 (pbx_thread           started at [ 2645] pbx.c
ast_pbx_start())
=== ---> Lock https://issues.asterisk.org/view.php?id=0 (chan_agent.c): MUTEX
1080 agent_new &p->app_lock
0x93d59d4 (1)
=== -------------------------------------------------------------------
===
=== Thread ID: 3075632016 (pbx_thread           started at [ 2645] pbx.c
ast_pbx_start())
=== ---> Tried and failed to get Lock https://issues.asterisk.org/view.php?id=0
(chan_local.c): MUTEX 186
local_queue_frame (channel lock) 0x9464470 (0)
=== -------------------------------------------------------------------
===
=======================================================================

If I hangup the initial agent call, if takes a long time for the Queue to
deliver the other call to the agent, while the agent is with no call, core
show locks shows this:

=======================================================================
=== Currently Held Locks ==============================================
=======================================================================
===
=== <file> <line num> <function> <lock name> <lock addr> (times locked)
===
=== Thread ID: 3077847952 (pbx_thread           started at [ 2645] pbx.c
ast_pbx_start())
=== ---> Lock https://issues.asterisk.org/view.php?id=0 (chan_agent.c): MUTEX
2252 __login_exec &p->app_lock
0x93d59d4 (1)
=== -------------------------------------------------------------------
===
=== Thread ID: 3076860816 (pbx_thread           started at [ 2645] pbx.c
ast_pbx_start())
=== ---> Tried and failed to get Lock https://issues.asterisk.org/view.php?id=0
(chan_local.c): MUTEX 186
local_queue_frame (channel lock) 0x945d820 (0)
=== -------------------------------------------------------------------
===
=======================================================================

When the queued call finally is delivered to the agent, core show locks
shows this, and the 100% usage stops:

=======================================================================
=== Currently Held Locks ==============================================
=======================================================================
===
=== <file> <line num> <function> <lock name> <lock addr> (times locked)
===
=== Thread ID: 3077847952 (pbx_thread           started at [ 2645] pbx.c
ast_pbx_start())
=== ---> Waiting for Lock https://issues.asterisk.org/view.php?id=0
(chan_agent.c): MUTEX 2252 __login_exec
&p->app_lock 0x93d59d4 (1)
=== --- ---> Locked Here: chan_agent.c line 1080 (agent_new)
=== -------------------------------------------------------------------
===
=== Thread ID: 3075632016 (pbx_thread           started at [ 2645] pbx.c
ast_pbx_start())
=== ---> Lock https://issues.asterisk.org/view.php?id=0 (chan_agent.c): MUTEX
1080 agent_new &p->app_lock
0x93d59d4 (1)
=== -------------------------------------------------------------------
===
=======================================================================
====================================================================== 

---------------------------------------------------------------------- 
 (0107327) pdhales (reporter) - 2009-07-01 20:03
 https://issues.asterisk.org/view.php?id=14639#c107327 
---------------------------------------------------------------------- 
I have a similar lockup with Asterisk 1.4.25.1 - locks up under high load
(approx 3000 calls per day). Slightly sanitised code follows:

exten => _XXXXXXXX,1,Set(__target=${EXTEN})
exten => _XXXXXXXX,n,Noop(${target})
exten => _XXXXXXXX,n,Queue(loop|ri|||60)
exten => _XXXXXXXX,n,Playback(greeting1)
exten => _XXXXXXXX,n,Queue(loop|i|||90)
exten => _XXXXXXXX,n(loopstart),Playback(holdmsg1)
exten => _XXXXXXXX,n,Queue(loop|i|||120)
exten => _XXXXXXXX,n,Playback(holdmsg2)
exten => _XXXXXXXX,n,Queue(loop|i|||90)
exten => _XXXXXXXX,n,Goto(loopstart)


[lqueue]
exten => s,1,Noop 
exten => s,n,Dial(DAHDI/G2/${target})
exten => s,n,Congestion

[loop]
joinempty = yes
leavewhenempty = no
ringinuse = yes
timeout=60
retry=20
strategy=random
timeoutrestart = yes

member => Local/s at lqueue 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-07-01 20:03 pdhales        Note Added: 0107327                          
======================================================================




More information about the asterisk-bugs mailing list