PHP 4.0 Bug #4727: Infinite while loop causes Apache process to hang around.
| From: | donncha dot ocaoimh at tradesignals dot com | Date: | Wed, 31 May 2000 12:36:43 +0000 |
| Subject: | PHP 4.0 Bug #4727: Infinite while loop causes Apache process to hang around. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-19872@lists.php.net to get a copy of this message | ||
From: donncha.ocaoimh@tradesignals.com
Operating system: linux,Solaris
PHP version: 4.0.0 Release
PHP Bug Type: Misbehaving function
Bug description: Infinite while loop causes Apache process to hang around.
<?php
while (true) {
print "hello world!";
sleep (1);
}
?>
The above script executes correctly on a PHP3 server and the Apache process serving the request is
freed up if the client cancels/shuts down.
On a PHP4 server the above loop causes the Apache process that served the request to hang and take
up resources:
$ date
Wed May 31 13:16:23 IST 2000
$ ps auxw|grep -c apache
252
$ date
Wed May 31 13:25:56 IST 2000
$ ps auxw|grep -c apache
252
Load average on the server is at 0.02, 0.57, 0.55 leading me to believe the loop isn't
executing even though the Apache processes are still around.
The test is repeatable. (I used wget 250 times on another box to drive the requests, then killed off
wget with "killall wget", both for PHP3 and PHP4 tests.)
Tested on Linux 2.2.15 and SunOS 5.6 using Apache 1.3.12, PHP4.0.0 and MySQL 3.23.16-alpha
Configure line for Linux box:
./configure --disable-xml --disable-debug --enable-inline-optimization --enable-sysvshm
--enable-sysvsem --with-mysql --without-gd --with-apxs=/usr/local/apache/bin/apxs
php.ini is unchanged from distribution one.