PHP 4.0 Bug #7747: after opening a socket and while reading from it php start growing CPU/MEM usag
| From: | pov at club-internet dot fr | Date: | Fri, 10 Nov 2000 15:42:09 +0000 |
| Subject: | PHP 4.0 Bug #7747: after opening a socket and while reading from it php start growing CPU/MEM usag | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-37691@lists.php.net to get a copy of this message | ||
From: pov@club-internet.fr
Operating system: FreeBSD 4.0-RELEASE Apache 1.3.14 mod_php4.so +libgd +libpq squid proxy
PHP version: 4.0.3pl1
PHP Bug Type: Performance problem
Bug description: after opening a socket and while reading from it php start growing CPU/MEM usag
I use a small script grabbed from fopen to get a ftp file since fopen is buggy when dealing with ftp:// urls with encoded path name (ie using abc%20def for example).
$datei = fsockopen("localhost", 3128, &$errno, &$errstr);
if( !$datei )
{
echo "proxy not available !";
fclose($resultfile);
exit();
}
else
{
fputs($datei,"GET $url HTTP/1.0\n\n");
set_time_limit(0);
fpassthru($datei);
}
The result is that as fpassthru sends the info from socket the mem usage grows dangerously and so
does the CPU usage (up to 75% of CPU on a P100 after sending 4 Megs). Doing a "while" with
a "print fgets" is even worth (but that sounds logical at least). Another
"interesting" behavior of this, is that when I don't add a set_time_limit, the httpd
child which delivers the info is killed with a signal 11 after 2-3 minutes and 40-45 sec. of CPU
time, even though my default time-limit is 30sec.
That's all I see for now.
--
Edit Bug report at: http://bugs.php.net/?id=7747&edit=1