endless loop script crashing apache

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • codesmithsf@gmail.com

    #1

    endless loop script crashing apache

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

    max_execution_t ime=90
    and memory_limit=32 M

    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?

    Thanks...

  • Andy Hassall

    #2
    Re: endless loop script crashing apache

    On 15 Aug 2005 11:45:56 -0700, codesmithsf@gma il.com wrote:
    [color=blue]
    >I'm using PHP 4.2.2 and Apache 2.0.4.0. A script running on a virtual
    >host had an endless loop in it that brought Apache to its knees. I have
    >
    >max_execution_ time=90
    >and memory_limit=32 M
    >
    >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?[/color]



    " Note: The set_time_limit( ) function and the configuration directive
    max_execution_t ime 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.

    --
    Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
    <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

    Comment

    • codesmithsf@gmail.com

      #3
      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.

      Comment

      Working...