[Home]

Summary:ASTERISK-13178: Delete a queue from realtime crashes Asterisk
Reporter:Cristian Dimache (cristiandimache)Labels:
Date Opened:2008-12-08 17:26:35.000-0600Date Closed:2008-12-15 10:10:39.000-0600
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Applications/app_queue
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 14033_16.patch
( 1) 14033.patch
( 2) gdb.txt
Description:Seems to be related to ASTERISK-1361703, but with realtime in the mix.
We use realtime and store our queues in MySQL. If you delete a queue, Asterisk crashes if you try an "queue show".
Using Asterisk 1.6.03-rc1.

****** ADDITIONAL INFORMATION ******

Steps to reproduce:
- add a queue to MySQL
- start Asterisk
- add another queue
- issue a CLI command: queue show
- delete the newly added queue
- issue a queue show twice
Comments:By: Mark Michelson (mmichelson) 2008-12-11 14:33:27.000-0600

Could you please follow the instructions in doc/backtrace.txt so that I can see a backtrace from the crash? Also, console output prior to the crash would be helpful. I will try reproducing the issue myself in the meantime.

By: Cristian Dimache (cristiandimache) 2008-12-12 06:31:38.000-0600

And the CLI...

*CLI> queue show
No queues.

[... add a queue in realtime ...]

*CLI> queue show
q1           has 0 calls (max unlimited) in 'ringall' strategy (0s holdtime), W:0, C:0, A:0, SL:0.0% within 0s
  No Members
  No Callers

[... delete the queue in realtime ...]
[... the queue still appears, even if i just deleted it in realtime ...]

*CLI> queue show
q1           has 0 calls (max unlimited) in 'ringall' strategy (0s holdtime), W:0, C:0, A:0, SL:0.0% within 0s
  No Members
  No Callers

*CLI> queue show
(null)       has 0 calls (max unlimited) in 'ringall' strategy (0s holdtime), W:0, C:0, A:0, SL:0.0% within 0s
Segmentation fault (core dumped)

By: Mark Michelson (mmichelson) 2008-12-12 11:09:15.000-0600

I have reproduced this issue in 1.6.0.2. In the 1.6.0 branch, the behavior is that the command hangs when I undergo the steps. In trunk, the behavior is also a crash. The problem appears to be a refcount issue, which are never fun to track down :(

Anyway, I'll do some tests running valgrind to track down the cause and hopefully I'll have a patch ready later today.

By: Mark Michelson (mmichelson) 2008-12-12 15:14:34.000-0600

After running about 53 billion tests, I believe I have found the source of the problem. I should have a patch written shortly for testing.

By: Mark Michelson (mmichelson) 2008-12-12 15:41:03.000-0600

I've uploaded two patches. One is called 14033.patch and is a patch made against the current Asterisk trunk. The other is 14033_16.patch and is made against the current tip of the 1.6.0 branch. If 14033_16.patch does not apply cleanly to the 1.6.0.2 tag, please let me know and I will make an alternate patch to test.

Thanks!

By: Cristian Dimache (cristiandimache) 2008-12-13 03:40:54.000-0600

Tested 14033.patch on SVN-trunk-r163991M - works ok.
Also, tested 14033_16.patch on 1.6.0.3-rc1 - works ok.

By: Digium Subversion (svnbot) 2008-12-15 10:10:38.000-0600

Repository: asterisk
Revision: 164268

U   trunk/apps/app_queue.c

------------------------------------------------------------------------
r164268 | mmichelson | 2008-12-15 10:10:38 -0600 (Mon, 15 Dec 2008) | 17 lines

Fix up a few issues with regards to queues

* Fix reference counting used in the __queues_show function
* Add code to be sure that the "queue show" command does not
 print information for a realtime queue which has been deleted
 from the backend
* Add a missing unref to the realtime queue loading function for
 the case where a queue is in the module's container but has been
 deleted from the realtime backend

(closes issue ASTERISK-13178)
Reported by: cristiandimache
Patches:
     14033.patch uploaded by putnopvut (license 60)
Tested by: cristiandimache


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

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