[asterisk-commits] dvossel: branch 1.6.0 r231560 - in /branches/1.6.0: ./ apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 30 12:58:07 CST 2009


Author: dvossel
Date: Mon Nov 30 12:58:05 2009
New Revision: 231560

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=231560
Log:
Merged revisions 231556 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r231556 | dvossel | 2009-11-30 12:55:07 -0600 (Mon, 30 Nov 2009) | 11 lines
  
  app_queue crashes randomly, often during call-transfers
  
  This patch adds a ref to the queue_ent object's parent call_queue
  in queue_exec() so the call_queue won't be destroyed
  while the the queue_ent still holds a pointer to it.
  
  (closes issue 0015686)
  Tested by: dvossel, aragon
........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_queue.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/apps/app_queue.c?view=diff&rev=231560&r1=231559&r2=231560
==============================================================================
--- branches/1.6.0/apps/app_queue.c (original)
+++ branches/1.6.0/apps/app_queue.c Mon Nov 30 12:58:05 2009
@@ -626,6 +626,11 @@
 		q->head = new;
 	}
 	new->next = cur;
+
+	/* every queue_ent must have a reference to it's parent call_queue, this
+	 * reference does not go away until the end of the queue_ent's life, meaning
+	 * that even when the queue_ent leaves the call_queue this ref must remain. */
+	queue_ref(q);
 	new->parent = q;
 	new->pos = ++(*pos);
 	new->opos = *pos;
@@ -4766,7 +4771,7 @@
 		AST_APP_ARG(rule);
 	);
 	/* Our queue entry */
-	struct queue_ent qe;
+	struct queue_ent qe = { 0 };
 	
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "Queue requires an argument: queuename[,options[,URL[,announceoverride[,timeout[,agi[,macro[,gosub[,rule]]]]]]]]\n");
@@ -4777,7 +4782,6 @@
 	AST_STANDARD_APP_ARGS(args, parse);
 
 	/* Setup our queue entry */
-	memset(&qe, 0, sizeof(qe));
 	qe.start = time(NULL);
 
 	/* set the expire time based on the supplied timeout; */
@@ -5035,6 +5039,13 @@
 	leave_queue(&qe);
 	if (reason != QUEUE_UNKNOWN)
 		set_queue_result(chan, reason);
+
+	if (qe.parent) {
+		/* every queue_ent is given a reference to it's parent call_queue when it joins the queue.
+		 * This ref must be taken away right before the queue_ent is destroyed.  In this case
+		 * the queue_ent is about to be returned on the stack */
+		qe.parent = queue_unref(qe.parent);
+	}
 
 	return res;
 }




More information about the asterisk-commits mailing list