Summary: | ASTERISK-10163: [patch] the fgets in res_agi can sometimes get interupted, but we dont handle it. | ||
Reporter: | Donny Kavanagh (donnyk) | Labels: | |
Date Opened: | 2007-08-24 11:42:44 | Date Closed: | 2007-09-18 17:27:17 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Resources/res_agi |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) res_agi_fgets_1.4svn.patch ( 1) res_agi_fgets-2.patch ( 2) res_agi_fgets-3.patch ( 3) res_agi_fgets-4.patch | |
Description: | as subject says. affects 1.2, 1.4, trunk. (but 1.2 wont be fixed) | ||
Comments: | By: Donny Kavanagh (donnyk) 2007-08-24 15:16:29 made a few small changes to the patch so we are going to retest in production monday. By: Donny Kavanagh (donnyk) 2007-08-28 14:42:22 tested all day and works great, no more partial fgets confusing agi. By: Digium Subversion (svnbot) 2007-09-11 10:08:18 Repository: asterisk Revision: 82245 ------------------------------------------------------------------------ r82245 | russell | 2007-09-11 10:08:17 -0500 (Tue, 11 Sep 2007) | 9 lines (closes issue ASTERISK-10163) Reported by: juggie Patches: res_agi_fgets-2.patch uploaded by juggie (license 24) Tested by: juggie When using fastagi, fgets() can return before a full line is read. Add explicit handling for the case where it gets interrupted. ------------------------------------------------------------------------ By: Digium Subversion (svnbot) 2007-09-11 10:10:11 Repository: asterisk Revision: 82246 ------------------------------------------------------------------------ r82246 | russell | 2007-09-11 10:10:11 -0500 (Tue, 11 Sep 2007) | 17 lines Merged revisions 82245 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r82245 | russell | 2007-09-11 10:26:51 -0500 (Tue, 11 Sep 2007) | 9 lines (closes issue ASTERISK-10163) Reported by: juggie Patches: res_agi_fgets-2.patch uploaded by juggie (license 24) Tested by: juggie When using fastagi, fgets() can return before a full line is read. Add explicit handling for the case where it gets interrupted. ........ ------------------------------------------------------------------------ By: Michiel van Baak (mvanbaak) 2007-09-12 05:32:23 festr_ on irc pointed out this fix broke his system By: Martin Vit (festr) 2007-09-12 05:39:43 The latest patch breaks my Agi(skript.php). Asap my skript writes to stdout I get this msgs: AGI Rx << temp buffer EXEC Set CHANNEL(language)=cz - errno Illegal seek and channel gets stuck in Ring state. By: Nicolas Chapleau (nicchap) 2007-09-12 06:21:42 festr, are you using straight AGI or FastAGI? Is debug line only showing once? Seems that the full command was received, but somehow wasn't processed. When you say that the channel remains in Ring state, do you no longer get events? Can I maybe see part of your script file? By: Martin Vit (festr) 2007-09-12 07:49:43 exten => *110,n,AGI(logged.php,${ARG3},${ARG4}) #!/usr/bin/php -q <?php require_once('definitions.php'); require_once('phpagi.php'); $debug = 0; set_time_limit(600); error_reporting(E_ALL); $agi = new AGI(); function connect_db() { $dblink = mysql_connect('localhost', MYSQLUSER, MYSQLPASS); if (!$dblink) { die('Could not connect: ' . mysql_error()); } mysql_select_db('ast'); return $dblink; } function get_sql($query) { if (!$result = mysql_query($query)) { echo "Chyba v query = $query<br/>". mysql_error(); exit -1; } return $result; } /************************* /* main */ $db = connect_db(); $agi->exec("Set",'CHANNEL(language)=cz'); $agi->exec("NoCDR",""); $agi->exec("Answer",""); ---------------------------------------------- this is the line, which i get the error. (CHANNEL(lang....) next command NoCDR will never execute and agi debug will get no other events. soft hangup does not work. By: Digium Subversion (svnbot) 2007-09-12 09:52:35 Repository: asterisk Revision: 82278 ------------------------------------------------------------------------ r82278 | russell | 2007-09-12 09:52:34 -0500 (Wed, 12 Sep 2007) | 3 lines revert patch from issue ASTERISK-10163, as someone not using fastagi reported that this broke their system. ------------------------------------------------------------------------ By: Digium Subversion (svnbot) 2007-09-12 09:54:14 Repository: asterisk Revision: 82279 ------------------------------------------------------------------------ r82279 | russell | 2007-09-12 09:54:14 -0500 (Wed, 12 Sep 2007) | 11 lines Merged revisions 82278 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r82278 | russell | 2007-09-12 10:11:11 -0500 (Wed, 12 Sep 2007) | 3 lines revert patch from issue ASTERISK-10163, as someone not using fastagi reported that this broke their system. ........ ------------------------------------------------------------------------ By: Donny Kavanagh (donnyk) 2007-09-12 10:25:28 festr, i'm working on something i'll post it soon. By: Donny Kavanagh (donnyk) 2007-09-12 10:46:50 just uploaded a new patch, res_agi_fgets-3. This has been confirmed to work with local agi, sorry about that oversight. I don't expect fastagi will be affected but i am posting this here so that, 1) festr can try it and confirm it works. 2) so my co-worker can run he tests on his fast agi stuff and report back. I'll confirm when our fastagi testing has been completed. By: Donny Kavanagh (donnyk) 2007-09-12 14:48:14 -4 uploaded, i left a minor change in the code which didn't belong. By: Martin Vit (festr) 2007-09-13 02:28:56 4.patch againts the latest 1.4 svn patching file res/res_agi.c Hunk #1 succeeded at 113 with fuzz 2 (offset 3 lines). Hunk #2 succeeded at 1834 (offset -32 lines). Hunk #3 succeeded at 1869 with fuzz 2 (offset -38 lines). Hunk #4 FAILED at 2080. Hunk ASTERISK-1 succeeded at 2069 (offset -72 lines). By: Donny Kavanagh (donnyk) 2007-09-17 14:03:08 ya sorry the patch is against trunk. By: Donny Kavanagh (donnyk) 2007-09-17 14:32:20 festr_ could you please test this patch for 1.4svn. By: Martin Vit (festr) 2007-09-18 04:30:05 juggie: res_agi_fgets_1.4svn.patch works OK. By: Donny Kavanagh (donnyk) 2007-09-18 09:15:25 this has also undergone our testing on 1.4 w/ about 85 concurrent sip calls using fastagi with no problem. By: Russell Bryant (russell) 2007-09-18 11:37:15 11:53 <@russellb> Juggie: i dont' see how that patch worked 11:54 <@russellb> you define AGI_RESULT_SUCCESS_FAST, but no code ever returns that 11:54 <@russellb> so it's not possible for the fast flag to ever get set By: Digium Subversion (svnbot) 2007-09-18 17:24:26 Repository: asterisk Revision: 82929 ------------------------------------------------------------------------ r82929 | russell | 2007-09-18 17:24:24 -0500 (Tue, 18 Sep 2007) | 11 lines Add a new patch to handle interrupting the fgets() call when using FastAGI. This version of the patch maintains the original behavior of the code when not using FastAGI. (closes issue ASTERISK-10163) Reported by: juggie Patches: res_agi_fgets-4.patch uploaded by juggie (license 24) res_agi_fgets_1.4svn.patch uploaded by juggie (license 24) Slight mods by me Tested by: juggie, festr ------------------------------------------------------------------------ By: Digium Subversion (svnbot) 2007-09-18 17:27:17 Repository: asterisk Revision: 82931 ------------------------------------------------------------------------ r82931 | russell | 2007-09-18 17:27:16 -0500 (Tue, 18 Sep 2007) | 19 lines Merged revisions 82929 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r82929 | russell | 2007-09-18 17:42:27 -0500 (Tue, 18 Sep 2007) | 11 lines Add a new patch to handle interrupting the fgets() call when using FastAGI. This version of the patch maintains the original behavior of the code when not using FastAGI. (closes issue ASTERISK-10163) Reported by: juggie Patches: res_agi_fgets-4.patch uploaded by juggie (license 24) res_agi_fgets_1.4svn.patch uploaded by juggie (license 24) Slight mods by me Tested by: juggie, festr ........ ------------------------------------------------------------------------ |