endless loop script crashing apache

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm using PHP 4.2.2 and Apache A script running on a virtual
host had an endless loop in it that brought Apache to its knees. I have

and memory_limit=32M

to handle larger file uploads and Gallery stuff (thumbnail processing)
but the script goes way past 90 seconds. Safe mode is off but the
script doesn't override it by using set_time_limit(). I have to restart
Apache to fix the problem. Apache Timeout is set to 300 seconds but
still goes way beyond that.

Any idea why the script might not be timing out?


Re: endless loop script crashing apache

On 15 Aug 2005 11:45:56 -0700, codesmithsf@gmail.com wrote:

Quoted text here. Click to load it


" Note:  The set_time_limit() function and the configuration directive
max_execution_time only affect the execution time of the script itself. Any
time spent on activity that happens outside the execution of the script such as
system calls using system(), stream operations, database queries, etc. is not
included when determining the maximum time that the script has been running."

 Are you sure it "brought Apache to its knees"? Was it instead the machine it
that slowed down? What are you processing thumbnails with - GD (extension) or
an external process such as ImageMagick? If external you could use "nice" to
drop the priority of the process down.

 It still shouldn't bring the rest of the system down on a Unix operating
system; the scheduler is there to make sure everything gets a resonable chance
to run even when the system is busy.

<http://www.andyhsoftware.co.uk/space Space: disk usage analysis tool

Re: endless loop script crashing apache

Thanks for the reply... one of the scripts in question was poorly
written and endlessly looping through files on a non-existent file
resource handle. So I guess the file system would fall under the caveat
you quoted.

But still as you said it shouldn't bring the rest of the system down.
How is one to safeguard the server?  I've checked out nice before but
didn't see any clear examples on how to properly use it.

Site Timeline