Summary:ASTERISK-05658: Deadlock in app_queue
Reporter:wunderkin (wunderkin)Labels:
Date Opened:2005-11-20 17:43:02.000-0600Date Closed:2006-05-19 16:23:15
Versions:Frequency of
Environment:Attachments:( 0) deadlock-queue-051120.txt
( 1) deadlock-queue-1.2-r7666.txt
( 2) full-bug5809.txt
Description:I'm getting a deadlock as soon as the agent answers the call.  The agent is logged in with an IAX softphone.

I'm originating a call via the manager using a local channel.  It then dials a SIP phone.  It is transferred to the queue and the agent picks up... then it deadlocks.

I was previously using 11/01 CVS and it had the same problem.

There is another queue deadlock bug ASTERISK-5634 but it doesn't look like the same problem.

This is what scrolls on the screen:
Nov 20 16:30:03 ERROR[19014]: ../include/asterisk/lock.h:236 __ast_pthread_mutex_lock: chan_agent.c line 1996 (__login_exec): Deadlock? waited 65 sec for mutex '&p->app_lock'?
Nov 20 16:30:03 ERROR[19014]: ../include/asterisk/lock.h:239 __ast_pthread_mutex_lock: chan_agent.c line 984 (agent_new): '&p->app_lock' was locked here.

strategy = rrmemory  
timeout = 15
eventwhencalled = yes
member => Agent/11000
;member => Agent/11001
;member => Agent/11002
member => Agent/1002
;member => Agent/1000


I'm also using the patch queue-stuff-v3.1.txt on bug 5577 and app_changrab 1.48.
Comments:By: Tilghman Lesher (tilghman) 2005-11-20 22:14:51.000-0600

Do you get the same problem if the SIP channel enters the Queue directly (i.e. not originating the call with AMI)?

By: wunderkin (wunderkin) 2005-11-20 22:28:36.000-0600

Same thing happens if I call using a SIP channel directly (not using the Local channel) and not through the manager.

By: Kevin P. Fleming (kpfleming) 2005-12-12 19:55:06.000-0600

If you can reproduce this problem using current release code and no external patches, then please reopen the bug report and provide a backtrace made from a core snapshot while the deadlock is in effect.

By: wunderkin (wunderkin) 2005-12-28 11:46:34.000-0600

I updated to branch 1.2 rev 7666 using no patches.  I still have this problem.
I also tested calling directly to the queue using a SIP phone - with and without sending a URL from the Queue app - and still have the same problem.

By: wunderkin (wunderkin) 2006-01-19 13:47:27.000-0600

agents.conf (minus any lines that are commented out)

agent => 11000,4321,Kevin

extensions.conf used for testing:
exten => 101,1,AgentLogin
exten => 301,1,Queue(testtype1)

I have attached full-bug5809.txt with a set debug 10 and set verbose 20.  I am currently using 1.2 release branch rev 8047.  I have a few bug patches on (5577, 6201, 6196) 2 out of the 3 of them have already been committed.  I tested with a plain-Jane Asterisk (after I updated, before I patched) and it had the same problem.

By: raarts (raarts) 2006-01-24 09:44:36.000-0600

Wunderkin, can you try calling without using the Local channel?

By: wunderkin (wunderkin) 2006-01-24 09:49:09.000-0600

This happens any time I use the Agent channel.  As I noted before, I was using the SIP channel and not Local channel on further testing.  I have taken everything down to barebones as shown on the note on 1-19.  Even if I make an exten to call Agent/11000 the same thing happens.

By: wunderkin (wunderkin) 2006-01-25 11:16:06.000-0600

I accidentally updated to trunk rev 8654 (no patches) and I had the same problem there too.

By: James Lyons (james) 2006-01-27 15:00:31.000-0600

I have attempted to lab this problem up on a machine here. As per your description, (correct me if i am wrong) a call generated by a SIP phone (in this case a cisco 7960) to a queue does not generate a deadlock when connected to an agent (an iaxy) logged in via AgentLogin. Asterisk ver: 8785

By: wunderkin (wunderkin) 2006-02-28 10:48:16.000-0600

Updated to 1.2 rev 11281, still having the same problem on multiple machines.

The only unique things I'm doing are: adding -march=pentium4/nocona, and using DEBUG_THREADS = -DDUMP_SCHEDULER -DDEBUG_SCHEDULER -DDEBUG_THREADS -DDETECT_DEADLOCKS

The audio still passes through fine even though I am getting deadlock warnings.  I tested using IAX and SIP so I don't think there is any 'reinviting' involved there.  They are both going through the same machine though.

I tried taking out DETECT_DEADLOCKS and the error goes away (of course).

So that's where this bug stands.  Something is going freaky with DETECT_DEADLOCKS and chan_agent.

By: Roberto Lopes (rflopes3) 2006-03-06 16:43:52.000-0600

Well, i have the same problem. Every time we dial out using Agent/ channels.

After the outbounding call (that works fine by the way), if the agent receives an inbound call from app_queue, then it locks.

By: Serge Vecher (serge-v) 2006-05-01 15:44:45

If this is still an issue then please provide the following information as per kpflemming:

"If you can reproduce this problem using current release code and no external patches, then please reopen the bug report and provide a backtrace made from a core snapshot while the deadlock is in effect."

By: Serge Vecher (serge-v) 2006-05-10 10:43:29

By: Serge Vecher (serge-v) 2006-05-19 16:22:57

looks like noone is able to reproduce the original problem, at this point. If anyone is still crash issues with queues and AgentCallbackLogin, please continue looking for solution in 6626. Otherwise, open a new report with a non-optimized backtrace from or latest stable at the time of opening the bug. Thank you!