[asterisk-bugs] [JIRA] Feedback Entered: (ASTERISK-20061) PHP Agi Socket Server stopped working - socket_read spamming Resource temporarily unavailable
Matt Jordan (JIRA)
noreply at issues.asterisk.org
Fri Aug 10 10:38:08 CDT 2012
[ https://issues.asterisk.org/jira/browse/ASTERISK-20061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matt Jordan updated ASTERISK-20061:
-----------------------------------
Assignee: Matt Jordan (was: Eike Kuiper)
Status: Open (was: Waiting for Feedback)
> PHP Agi Socket Server stopped working - socket_read spamming Resource temporarily unavailable
> ---------------------------------------------------------------------------------------------
>
> Key: ASTERISK-20061
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-20061
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Resources/res_agi
> Affects Versions: 1.8.13.0
> Environment: CentOS 5, kernel-2.6.238
> Reporter: Eike Kuiper
> Assignee: Matt Jordan
> Severity: Minor
> Attachments: debug.log
>
>
> Hi Developers,
> I have a php agi socket server and various classes to extend my pbx. This socket server worked well with Ver. 1.8.6.0,
> but after i updated to version 1.8.13.0 it stopped working. The function socket_read threw the error 11(Ressource temporarily unavailable). I searched the mistake in the res_agi.c file and found that the following lines caused an infinite loop:
> {noformat}
> while (len > 1) {
> res = fgets(buf + buflen, len, readf);
> if (feof(readf))
> break;
> if (ferror(readf) && ((errno != EINTR) && (errno != EAGAIN)))
> break;
> if (res != NULL && !agi->fast)
> break;
> buflen = strlen(buf);
> if (buflen && buf[buflen - 1] == '\n')
> break;
> len = sizeof(buf) - buflen;
> if (agidebug)
> ast_verbose( "AGI Rx << temp buffer %s - errno %s\n", buf, strerror(errno));
> }
> {noformat}
> Comparing the res_agi.c file from Ver. 1.8.13.0 and 1.8.6.0, i changed the following back to Ver. 1.8.6.0:
> while (len > 1) {
> to:
> while (buflen < (len - 1)) {
> and:
> len = sizeof(buf) - buflen;
> to:
> len -= buflen;
> After i compiled these changes (fully recompiled asterisk in fact) and updated my pbx again and
> my php agi socket server were fully working.
> I don't understand correctly why the len is set to the size of the bytes for this datatype and substracting the lenght of buf string.
> Cheers
> Eike
> P.S: Please excuse my bad english...
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the asterisk-bugs
mailing list