You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ro...@imdb.com> on 1997/10/24 15:08:17 UTC

child process limits

Is there any way to configure Apache to give it time limits on a
child process ? We can set limits for CGI but how about the apache
processes themselves ?

I've seen a couple of my httpd's stuck in a cpu chewing state. This
is probably some accidental infinite loop in my own perl running
with mod_perl. These problems are hard to catch and even after
ataching gdb to a process it's not always easy to trace back to the
offending code/url combo. While trying to track these problems down
it'd be very useful to have a way to limit the cpu time the process
is allowed so I can nuke anything running for more than a couple of
minutes.

Is there a way to do this ?

--
Rob Hartill                              Internet Movie Database (Ltd)
http://www.moviedatabase.com/   .. a site for sore eyes.


Re: child process limits

Posted by Dean Gaudet <dg...@arctic.org>.

On Sat, 25 Oct 1997, Rob Hartill wrote:

> I think I'm risking the parent process doing it this way, has
> anyone looked into anything similar ?

You could give it a reasonable soft cpu limit, and trap SIGXCPU in the
parent, and raise the limit.  Or you could write a module which has a
child_init function which gives each child a reasonable limit.

Dean


Re: child process limits

Posted by Rob Hartill <ro...@imdb.com>.
On Fri, 24 Oct 1997, Dean Gaudet wrote:

> This came up a few months ago, a fellow here posted a patch he was using. 
> It wasn't something we could include in the distribution though.  See also
> PR#1028 for my ideas regarding memory resources. 

I had a look. I 'solve' my memory hogging processes (if they should ever
occur accidentally) by starting the parent with memory limits..
ulimit -Hd 30000 ; /usr/local/httpd/httpd -d /usr/local/httpd
This has worked well for me. The problem I saw recently wasn't a
process increasing in size, it was just hogging the cpu.

Maybe I need to do something similar with cpu usage. Looking at top,
a parent process on one of my servers has used 3 seconds of cpu in
the last 6 quiet hours. Maybe it's safe to assume that my parent
process will never use >5 minutes of cpu time in a 24 hour period.

I think I'm risking the parent process doing it this way, has
anyone looked into anything similar ?

--
Rob Hartill                              Internet Movie Database (Ltd)
http://www.moviedatabase.com/   .. a site for sore eyes.


Re: child process limits

Posted by Dean Gaudet <dg...@arctic.org>.
This came up a few months ago, a fellow here posted a patch he was using. 
It wasn't something we could include in the distribution though.  See also
PR#1028 for my ideas regarding memory resources. 

Dean

On Fri, 24 Oct 1997, Rob Hartill wrote:

> 
> Is there any way to configure Apache to give it time limits on a
> child process ? We can set limits for CGI but how about the apache
> processes themselves ?
> 
> I've seen a couple of my httpd's stuck in a cpu chewing state. This
> is probably some accidental infinite loop in my own perl running
> with mod_perl. These problems are hard to catch and even after
> ataching gdb to a process it's not always easy to trace back to the
> offending code/url combo. While trying to track these problems down
> it'd be very useful to have a way to limit the cpu time the process
> is allowed so I can nuke anything running for more than a couple of
> minutes.
> 
> Is there a way to do this ?
> 
> --
> Rob Hartill                              Internet Movie Database (Ltd)
> http://www.moviedatabase.com/   .. a site for sore eyes.
> 
>