Summary: | ASTERISK-12023: [patch] Autoservice loses DTMF digits | ||
Reporter: | Dmitry Andrianov (dimas) | Labels: | |
Date Opened: | 2008-05-15 05:24:19 | Date Closed: | 2008-05-29 17:25:22 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Core/PBX |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) v1-12656.patch ( 1) v2-12656.patch ( 2) v3-12656.patch | |
Description: | There is a problem with how autoservice handles its internal list of channels. Basically: 1. it traverses the asent list and copies all the channels from the list into an array 2. it waitfor on this array 3. if anything was received, it traverses the asent list again to map channel back to AS entry (in order to queue received frame there) autoservice_stop removes a channel from the list and waits when list version updates (to make sure AS thread does not need this channel anymore). The problem occurs when autoservice_stop is called between 1 and 3. The channel may be _already_ in the waitfor call when removed from the list. So when AS thread returns from ast_waitfor/ast_read it fails finfing this channel in the list and just discards the frame received. in my setup this causes sometimes DTMFs to be lost. ****** ADDITIONAL INFORMATION ****** I'm providing the patch which works for me. I would prefer making more serious one by moving all the content of asent into ast_channel - this way you we wan't need all these lists traversals in order to map channel to asent. But I'm almost sure you guys won't accept such a change for 1.4 :) | ||
Comments: | By: Dmitry Andrianov (dimas) 2008-05-16 05:35:29 Oops. I forgot to initialize one variable - leads to a crash. Fixed in v2 patch By: Dmitry Andrianov (dimas) 2008-05-16 06:31:56 Ohh... Had to redo autoservice_stop because now AS thread can still have a reference to asent even after it was removed from the list. So removed entry can not be manipulated/freed before AS thread rebuilds its array. v3 fixes this By: Digium Subversion (svnbot) 2008-05-29 17:18:01 Repository: asterisk Revision: 119156 U branches/1.4/main/autoservice.c ------------------------------------------------------------------------ r119156 | russell | 2008-05-29 17:18:01 -0500 (Thu, 29 May 2008) | 10 lines Fix a race condition in channel autoservice. There was still a small window of opportunity for a DTMF frame, or some other deferred frame type, to come in and get dropped. (closes issue ASTERISK-12023) (closes issue ASTERISK-12023) Reported by: dimas Patches: v3-12656.patch uploaded by dimas (license 88) -- with some modifications by me ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=119156 By: Digium Subversion (svnbot) 2008-05-29 17:22:31 Repository: asterisk Revision: 119157 _U trunk/ U trunk/main/autoservice.c ------------------------------------------------------------------------ r119157 | russell | 2008-05-29 17:22:31 -0500 (Thu, 29 May 2008) | 18 lines Merged revisions 119156 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r119156 | russell | 2008-05-29 17:24:29 -0500 (Thu, 29 May 2008) | 10 lines Fix a race condition in channel autoservice. There was still a small window of opportunity for a DTMF frame, or some other deferred frame type, to come in and get dropped. (closes issue ASTERISK-12023) (closes issue ASTERISK-12023) Reported by: dimas Patches: v3-12656.patch uploaded by dimas (license 88) -- with some modifications by me ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=119157 By: Digium Subversion (svnbot) 2008-05-29 17:25:22 Repository: asterisk Revision: 119158 _U branches/1.6.0/ U branches/1.6.0/main/autoservice.c ------------------------------------------------------------------------ r119158 | russell | 2008-05-29 17:25:22 -0500 (Thu, 29 May 2008) | 26 lines Merged revisions 119157 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r119157 | russell | 2008-05-29 17:28:50 -0500 (Thu, 29 May 2008) | 18 lines Merged revisions 119156 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r119156 | russell | 2008-05-29 17:24:29 -0500 (Thu, 29 May 2008) | 10 lines Fix a race condition in channel autoservice. There was still a small window of opportunity for a DTMF frame, or some other deferred frame type, to come in and get dropped. (closes issue ASTERISK-12023) (closes issue ASTERISK-12023) Reported by: dimas Patches: v3-12656.patch uploaded by dimas (license 88) -- with some modifications by me ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=119158 |