#37641 [Opn]: recv in fastcgi never returns when server doesn't pad to size of 8
| From: | roguestar191 at comcast dot net | Date: | Tue, 30 May 2006 09:37:18 +0000 |
| Subject: | #37641 [Opn]: recv in fastcgi never returns when server doesn't pad to size of 8 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-97789@lists.php.net to get a copy of this message | ||
ID: 37641
User updated by: roguestar191 at comcast dot net
Reported By: roguestar191 at comcast dot net
Status: Open
Bug Type: CGI related
Operating System: linux
PHP Version: 5.1.4
New Comment:
sorry that should be "when the server doesn't pad all the packets to
the size of 8"
Previous Comments:
------------------------------------------------------------------------
[2006-05-30 09:35:50] roguestar191 at comcast dot net
Description:
------------
line 624 of sapi/cgi/fastcgi.c contains:
while (recv(req->fd, buf, strlen(buf), 0) > 0) {}
with buf being an array with 8 elements.
With the server doesn't pad all packets to the size of 8
(Which is suggested but not required by the fast-cgi spec), this causes
frequent lockups and failed requests. (Without that padding, I have no
idea about with it).
My fix was simple - change strlen(buf) (which returns 8), to 1, so it
will read any excess bytes at the end and cleanly close and continue
on, even if it's not a multiple of 8 bytes.
Thank you for php!
Expected result:
----------------
fast-cgi padding to be read and thrown out, requests to close.
Actual result:
--------------
request tends to lock up on recv when packets arn't a multiple of 8 in
size.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37641&edit=1