You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Trevor Phillips <T....@murdoch.edu.au> on 2004/01/09 03:45:16 UTC

Apache::Resource/RLIMIT_AS problem

I used to use Apache::Resource to stop runaway apache daemons from impacting 
the system, but stopped using it when I made some pretty major mods to my 
Apache config (involving replacing large chunks of traditional config with 
<Perl> blocks).

After that, Apache::Resource stopped working. More to the point, it used to 
kill every daemon on any request, and logged the error:
   Ouch!  malloc failed in malloc_block()

I did some experimentation, and found if I increased the values used for 
PERL_RLIMIT_AS, then things started working again. Now, although the perldoc 
for Apache::Resource implies that RLIMIT_AS numbers are in "natural units", 
not Megs, the examples imply this IS in Meg.

At the moment, I'm setting it to PERL_RLIMIT_AS = 120:140. It now seems to 
kill runaway processes at about 50Meg in size - but I have no idea if 
RLIMIT_AS is in some weird units (natural or not), or if there's an overhead 
I have to add beyond the normal process size to calculate this value.

Can someone please explain what's going on? I'd rather know what the values 
mean, rather than randomly experimenting with values till I get what I'm 
after.

The system is running Debian 3.0/woody, and is running the Debian mod_perl, 
version 1.26.

-- 
. Trevor Phillips             -           http://jurai.murdoch.edu.au/ . 
: Web Technical Administrator     -          T.Phillips@murdoch.edu.au : 
| IT Services                        -              Murdoch University | 
 >--------------------------------------------------------------------<
| On nights such as this, evil deeds are done. And good deeds, of     /
| course. But mostly evil, on the whole.                             /
 \      -- (Terry Pratchett, Wyrd Sisters)                          /


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Apache::Resource/RLIMIT_AS problem

Posted by Perrin Harkins <pe...@elem.com>.
Trevor Phillips wrote:
> Apache::Resource uses BSD::Resource. However, the Apache::Resource docs are 
> unclear on the units for PERL_RLIMIT_AS, but imply it is in megabytes. The 
> BSD::Resource docs state that it is in bytes, so it seems Apache::Resource is 
> at least converting the units as presented in BSD::Resource to something 
> else.

You really should look at the source.  Everything else is just guessing 
at this point.

- Perrin


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Apache::Resource/RLIMIT_AS problem

Posted by Trevor Phillips <T....@murdoch.edu.au>.
On Tuesday 13 January 2004 14:22, Perrin Harkins wrote:
> 
> You could also look at BSD::Resource, or one of the other ways of
> setting RLIMIT on your system.

Apache::Resource uses BSD::Resource. However, the Apache::Resource docs are 
unclear on the units for PERL_RLIMIT_AS, but imply it is in megabytes. The 
BSD::Resource docs state that it is in bytes, so it seems Apache::Resource is 
at least converting the units as presented in BSD::Resource to something 
else.

Editing Apache::Resource, the comment next to the default RLIMIT_AS says the 
unit is in megabytes. If that's true, then I'm back to wondering why a value 
of 120:140 kills daemons at 50.

-- 
. Trevor Phillips             -           http://jurai.murdoch.edu.au/ . 
: Web Technical Administrator     -          T.Phillips@murdoch.edu.au : 
| IT Services                        -              Murdoch University | 
 >--------------------------------------------------------------------<
| On nights such as this, evil deeds are done. And good deeds, of     /
| course. But mostly evil, on the whole.                             /
 \      -- (Terry Pratchett, Wyrd Sisters)                          /


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Apache::Resource/RLIMIT_AS problem

Posted by Perrin Harkins <pe...@elem.com>.
Trevor Phillips wrote:
> Does no-one know what is causing this discrepancy?

Probably no one currently on this list does know.  Unless you can find 
the information in the mail archive, you'll need to look at the code or 
get someone else to look at it for you.

You could also look at BSD::Resource, or one of the other ways of 
setting RLIMIT on your system.

- Perrin


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Apache::Resource/RLIMIT_AS problem

Posted by Trevor Phillips <T....@murdoch.edu.au>.
On Tuesday 13 January 2004 13:32, Trevor Phillips wrote:
> On Friday 09 January 2004 10:45, Trevor Phillips wrote:
> > At the moment, I'm setting it to PERL_RLIMIT_AS = 120:140. It now seems
> > to kill runaway processes at about 50Meg in size - but I have no idea if
> > RLIMIT_AS is in some weird units (natural or not), or if there's an
> > overhead I have to add beyond the normal process size to calculate this
> > value.
>
> Does no-one know what is causing this discrepancy?

Ok, I've found the CAUSE: mod_php4! If I don't load mod_php4, then RLIMIT_AS 
works as expected: The limits are in Mb, and behave as one expects. If I load 
mod_php4, then suddenly I require an RLIMIT_AS of 120:140 to get it to kill 
processes at 50Meg...

*sigh*
Now, WHY it's doing this I still have no idea, but I have another avenue to 
search down now at least...

-- 
. Trevor Phillips             -           http://jurai.murdoch.edu.au/ . 
: Web Technical Administrator     -          T.Phillips@murdoch.edu.au : 
| IT Services                        -              Murdoch University | 
 >--------------------------------------------------------------------<
| On nights such as this, evil deeds are done. And good deeds, of     /
| course. But mostly evil, on the whole.                             /
 \      -- (Terry Pratchett, Wyrd Sisters)                          /


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Apache::Resource/RLIMIT_AS problem

Posted by Trevor Phillips <T....@murdoch.edu.au>.
On Friday 09 January 2004 10:45, Trevor Phillips wrote:
> 
> At the moment, I'm setting it to PERL_RLIMIT_AS = 120:140. It now seems to
> kill runaway processes at about 50Meg in size - but I have no idea if
> RLIMIT_AS is in some weird units (natural or not), or if there's an
> overhead I have to add beyond the normal process size to calculate this
> value.

Does no-one know what is causing this discrepancy?
SHOULD RLIMIT_AS be in Megs, or is it some other units?

-- 
. Trevor Phillips             -           http://jurai.murdoch.edu.au/ . 
: Web Technical Administrator     -          T.Phillips@murdoch.edu.au : 
| IT Services                        -              Murdoch University | 
 >--------------------------------------------------------------------<
| On nights such as this, evil deeds are done. And good deeds, of     /
| course. But mostly evil, on the whole.                             /
 \      -- (Terry Pratchett, Wyrd Sisters)                          /


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html