[Home]

Summary:ASTERISK-13384: Asterisk crashes anytime in call queues
Reporter:Carlos Cesario (ccesario)Labels:
Date Opened:2009-01-16 12:23:24.000-0600Date Closed:2009-03-18 12:23:17
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Applications/app_queue
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 14260.patch
( 1) bt.txt
( 2) btfull.txt
( 3) new_valgrind.txt
( 4) valgrind.txt
Description:My asterisk crash in sporadic periods with call queues, I attached the valgrind and bt results.

I tested with asterisk-1.6.0.3 and too happen the problem
Comments:By: Mark Michelson (mmichelson) 2009-01-20 16:05:28.000-0600

I think this is no longer an issue in trunk.

There have been some queue fixes applied for issues ASTERISK-13187 and ASTERISK-13221 which I am confident also fix this issue, too. Please try updating your trunk checkout to see if the problem still exists there.

By: Carlos Cesario (ccesario) 2009-01-22 09:52:25.000-0600

Hi putnopvut, I update asterisk to svn version 170046, and I get  crash with queues.

I attached the new bt results

By: Mark Michelson (mmichelson) 2009-01-22 12:26:00.000-0600

Can you post new valgrind output from this version? Thanks!

By: Carlos Cesario (ccesario) 2009-01-22 13:39:15.000-0600

Sure,

  I suspect that the problem is in any point from pickupxten, this isn't work with this svn version :/

  the new valgrind is attached!

By: Mark Michelson (mmichelson) 2009-01-22 18:16:20.000-0600

I have finally figured out how to reproduce this issue and will attempt to come up with a suitable fix.

By: Mark Michelson (mmichelson) 2009-01-22 18:39:20.000-0600

The problem appears to be that when an attended transfer is used on a call to a queue member, the end_bridge_callback in app_queue.c is called from the bridging code. The problem is that the data passed to app_queue.c is invalid at this point since the variable we were referencing has gone out of scope.

By: Mark Michelson (mmichelson) 2009-01-23 13:38:54.000-0600

I have created a patch for this issue. Please test it and let me know if it causes the crashes to stop.

By: Carlos Cesario (ccesario) 2009-01-27 11:47:24.000-0600

Putnopvut,

  I applied the patch and the running to two days without any crash.
  The patch appear fixed the problem!!


thanks!

By: Digium Subversion (svnbot) 2009-01-27 13:30:15.000-0600

Repository: asterisk
Revision: 171618

U   trunk/apps/app_queue.c

------------------------------------------------------------------------
r171618 | mmichelson | 2009-01-27 13:30:14 -0600 (Tue, 27 Jan 2009) | 24 lines

Fix queue crashes that would occur after the calling channel was masqueraded.

The data passed to the end_bridge_callback was assumed to be data which was
still stack'd. The problem was that with some call features, attended transfers
in particular, a new bridge thread is started once the feature completes, meaning
that when the end_bridge_callback is called, the end_bridge_callback_data was
invalid.

To fix this problem, there are two measures taken

1. Instead of pointing to stacked data, we now used heap-allocated data for
passing to the end_bridge_callback in app_queue
2. Since bridges can end multiple times on a single logical call, we wait until
the final bridge is broken to actually set any queue variables. This is accomplished
through reference-counting and the use of an end_bridge_callback_data_fixup function
in app_queue.c

(closes issue ASTERISK-13384)
Reported by: ccesario
Patches:
     14260.patch uploaded by putnopvut (license 60)
Tested by: ccesario


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

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

By: Digium Subversion (svnbot) 2009-01-27 13:37:46.000-0600

Repository: asterisk
Revision: 171619

_U  branches/1.6.0/
U   branches/1.6.0/apps/app_queue.c

------------------------------------------------------------------------
r171619 | mmichelson | 2009-01-27 13:37:46 -0600 (Tue, 27 Jan 2009) | 32 lines

Merged revisions 171618 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
r171618 | mmichelson | 2009-01-27 13:30:54 -0600 (Tue, 27 Jan 2009) | 24 lines

Fix queue crashes that would occur after the calling channel was masqueraded.

The data passed to the end_bridge_callback was assumed to be data which was
still stack'd. The problem was that with some call features, attended transfers
in particular, a new bridge thread is started once the feature completes, meaning
that when the end_bridge_callback is called, the end_bridge_callback_data was
invalid.

To fix this problem, there are two measures taken

1. Instead of pointing to stacked data, we now used heap-allocated data for
passing to the end_bridge_callback in app_queue
2. Since bridges can end multiple times on a single logical call, we wait until
the final bridge is broken to actually set any queue variables. This is accomplished
through reference-counting and the use of an end_bridge_callback_data_fixup function
in app_queue.c

(closes issue ASTERISK-13384)
Reported by: ccesario
Patches:
     14260.patch uploaded by putnopvut (license 60)
Tested by: ccesario


........

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

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

By: Digium Subversion (svnbot) 2009-01-27 13:42:41.000-0600

Repository: asterisk
Revision: 171620

_U  branches/1.6.1/
U   branches/1.6.1/apps/app_queue.c

------------------------------------------------------------------------
r171620 | mmichelson | 2009-01-27 13:42:40 -0600 (Tue, 27 Jan 2009) | 32 lines

Merged revisions 171618 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
r171618 | mmichelson | 2009-01-27 13:30:54 -0600 (Tue, 27 Jan 2009) | 24 lines

Fix queue crashes that would occur after the calling channel was masqueraded.

The data passed to the end_bridge_callback was assumed to be data which was
still stack'd. The problem was that with some call features, attended transfers
in particular, a new bridge thread is started once the feature completes, meaning
that when the end_bridge_callback is called, the end_bridge_callback_data was
invalid.

To fix this problem, there are two measures taken

1. Instead of pointing to stacked data, we now used heap-allocated data for
passing to the end_bridge_callback in app_queue
2. Since bridges can end multiple times on a single logical call, we wait until
the final bridge is broken to actually set any queue variables. This is accomplished
through reference-counting and the use of an end_bridge_callback_data_fixup function
in app_queue.c

(closes issue ASTERISK-13384)
Reported by: ccesario
Patches:
     14260.patch uploaded by putnopvut (license 60)
Tested by: ccesario


........

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

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