|
Home > Archive > Web Servers on Unix and Linux > April 2004 > apache: RLimitCPU does not work
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
apache: RLimitCPU does not work
|
|
| Felix Natter 2004-04-22, 9:45 am |
| hi,
I have
RLimitCPU 30 30
in both the VirtualHost and at the end of httpd.conf. I restarted
apache.
Now if I run this script (compiled):
======================
#include <stdio.h>
#include <unistd.h>
int main()
{
int i;
fprintf (stdout, "Content-type: text/html\n\nhello world\n");
fflush (stdout);
i = 0;
while (1)
{
fprintf (stdout, "i=%d\n", i);
fflush (stdout);
sleep (1);
i++;
}
return 0;
}
======================
it runs forever:
hello world i=0 i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 i=9 i=10 i=11 i=12 i=13 i=14 i=15 i=16 i=17 i=18 i=19 i=20 i=21 i=22 i=23 i=24 i=25 i=26 i=27 i=28 i=29 i=30 i=31 i=32 i=33 [...]
This is SuSE Linux 7.x with apache 1.3.12 (but I have the same problem
on debian 3.0 with apache 1.3.26).
thanks,
--
Felix Natter
| |
| André Malo 2004-04-22, 12:40 pm |
| * Felix Natter <felix.natter@ldc.de> wrote:
> I have
> RLimitCPU 30 30
[..]
> it runs forever:
No, it runs until it has used 30 CPU seconds (vs. wall clock seconds).
nd
| |
| Joshua Slive 2004-04-22, 4:39 pm |
| Felix Natter <felix.natter@ldc.de> wrote in message news:<m3r7ugyx2f.fsf@werkstatt4.ldc>...
> hi,
>
> I have
> RLimitCPU 30 30
> in both the VirtualHost and at the end of httpd.conf. I restarted
> apache.
>
> Now if I run this script (compiled):
> while (1)
> {
> fprintf (stdout, "i=%d\n", i);
> fflush (stdout);
> sleep (1);
> i++;
> }
> ======================
> it runs forever:
I know very limit about rlimit stuff, but let me point out one thing:
This directive limits CPU time, not clock time. The program you quote
above uses a tiny fraction of a CPU second per clock second. I
wouldn't be surprised if it took a couple hours for it to reach 30 CPU
seconds.
Take everything out of the loop except the i++; and then see if it
gets killed.
Joshua.
|
|
|
|
|