|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-07-26 00:12 UTC] zak@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 04:00:01 2025 UTC |
If I run a script containing a function with an infinite loop (like the code below) and then hit the stop button in Netscape, httpd wil continue to consume somewhere between 93 and 99 % of my total CPU cycles. This goes on forever until I restart httpd. You can force this behaviour in many ways, a while ( 1 == 1 ) loop will also do nicely (anything that loops indefinately). Here's a script that will show the bug: ------- Start of buggy PHP script ----------- <html> <head> <title>Buggy PHP script</title> </head> <body> <?php for ( ; ; ) { print("Bug<br>\n"); } ?> </body> </html> ------- End of buggy PHP script ----------- Here's a dump from "top" showing httpd burning CPU cycles after running the script above (top has been set to a refresh interval of one second): PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND 454 nobody 17 0 46048 13M 1192 R 0 97.0 11.5 10:44 httpd I know that the script is buggy, but I'd expect it to terminat when the browser stops loading data from it - is this a wrong assumption? My configure line for PHP 4.0RC2 looks like this ./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs --with-config-file-path=/etc/httpd --enable-calendar --enable-trans-sid --enable-versioning --enable-track-vars If you need my php.ini file - just ask, I'll email it upon request. Best regards Jesper Juhl