[asterisk-bugs] [Asterisk 0018430]: Segfault when ExternalIVR() app. immediately sends S command due to race condition

Asterisk Bug Tracker noreply at bugs.digium.com
Sat Dec 11 11:57:56 CST 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=18430 
====================================================================== 
Reported By:                stevebrandli
Assigned To:                thedavidfactor
====================================================================== 
Project:                    Asterisk
Issue ID:                   18430
Category:                   Applications/app_externalivr
Reproducibility:            always
Severity:                   crash
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           1.8.0 
JIRA:                       SWP-2686 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-12-06 21:01 CST
Last Modified:              2010-12-11 11:57 CST
====================================================================== 
Summary:                    Segfault when ExternalIVR() app. immediately sends S
command due to race condition
Description: 
Segfault occurs if the ExternalIVR() application sends an S command faster
than the sound generator can setup and "play silence."  The segfault occurs
because the code believes it must send a T event but there are no sound
files current playing.

Entire extensions.conf:
[internal]
70,1,ExternalIVR(/var/lib/asterisk/agi-bin/fndatyivr.py)
70,n,Hangup()

Entire python script referenced above:
#!/usr/bin/python
import sys
import time
#time.sleep(1)
sys.stdout.write("S,/etc/asterisk/sounds/fndaty/WaitBrandli\n")
sys.stdout.flush()
time.sleep(10)

Just dial extension 70.  Notice the if the time.sleep(1) line in the
python script is uncommented, there is no problem.  I assume it is possible
that other setups will have trouble reproducing because application
execution takes longer.

Please consider relating issue https://issues.asterisk.org/view.php?id=17335.
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0017335 ExternalIVR 'S' command sometimes resul...
====================================================================== 

---------------------------------------------------------------------- 
 (0129548) thedavidfactor (manager) - 2010-12-11 11:57
 https://issues.asterisk.org/view.php?id=18430#c129548 
---------------------------------------------------------------------- 
It appears to definitely be a timing issue. I'm running asterisk in a VM
and it only crashed every once in a while, but I was able to duplicate the
problem. If I turned verbosity up to four or higher the I couldn't get it
to crash at all. My only concern with the fix suggested was the possibility
of problems when ExternalIVR was run on an unanswered channel, however I
tested it and it didn't cause any problems. I am attaching a patch that
initializes playing_silence to 1 when the struct is first initialized.
Please test and confirm this fixes the problem in your environment. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-12-11 11:57 thedavidfactor Note Added: 0129548                          
======================================================================




More information about the asterisk-bugs mailing list