You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Klaas [xs4all.nl]" <kl...@xs4all.nl> on 2005/02/19 17:41:28 UTC

[users@httpd] Apache freezes system

Hi group,

After a few weeks of experimenting and asking for help in the newsgroups 
  I finally decided to try my luck here :)

The problem:

I have a webserver, dual Intel-Xeon with 2GB of RAM, it's running Debian 
  Sarge with kernel 2.6.8-smp (debian default kernel).
I'm using Apache 1.3.33 with php 4.3.10-2

The problem I've encounterd is that from time to time an apache child is 
responsable for freezing the system for about 20 minutes.
What happens: once or twice a day (or not at all) at completely random 
times there's an apache child who's memory consumption runs wild. The 
result: the system runs out of memory because of this process and that 
results in the system load going sky-high. At that moment the kernel 
oom-killer comes in action and after aproc. 20 minutes the system is 
accesible again.

The process I monitored used almost 70% (!) of the memory, but when I 
traced that process in the server-status there is no reason why it 
should use that amount of memory. Also there are no messages according 
to this problem in the error.log (with logging on debug mode).

Setting from the httpd.conf:
MinSpareServers 10
MaxSpareServers 20
StartServers 5
MaxClients 150
MaxRequestsPerChild 10000 (I've tested also with 100, but there is no 
difference)

ps auxf output:
root     11004  0.4  0.0 14048 1596 pts/0    S    Feb17   0:12 
/usr/sbin/apache
www-data 11005  0.7  0.6 24336 13308 pts/0   S    Feb17   0:20  \_ 
/usr/sbin/apache
www-data 11006  0.6  0.2 15392 5296 pts/0    S    Feb17   0:16  \_ 
/usr/sbin/apache
www-data 11007  0.9  0.2 16976 5664 pts/0    S    Feb17   0:24  \_ 
/usr/sbin/apache
www-data 11008  0.5  0.2 15800 4820 pts/0    S    Feb17   0:15  \_ 
/usr/sbin/apache
www-data 11009  0.5  0.2 15740 5648 pts/0    S    Feb17   0:15  \_ 
/usr/sbin/apache
www-data 11011  0.7  0.2 15692 4684 pts/0    S    Feb17   0:19  \_ 
/usr/sbin/apache
www-data 11012  1.1  0.2 15648 5428 pts/0    S    Feb17   0:31  \_ 
/usr/sbin/apache
www-data 11013  1.0 63.3 1763240 1314412 pts/0 S  Feb17   0:28  \_ 
/usr/sbin/apache

Anyone an idea how to fix this?

Klaas

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache freezes system

Posted by Dirk-Willem van Gulik <di...@webweaving.org>.

On Sat, 19 Feb 2005, Klaas [xs4all.nl] wrote:

> I have a webserver, dual Intel-Xeon with 2GB of RAM, it's running Debian
>   Sarge with kernel 2.6.8-smp (debian default kernel).
> I'm using Apache 1.3.33 with php 4.3.10-2
>
> The problem I've encounterd is that from time to time an apache child is
..
> The process I monitored used almost 70% (!) of the memory, but when I

You want to first set some RLimits to stop any process (and in particular
your naughty Php script) from taking that much memory.

	RLimitMEM 1024000 2048000
and propably also
	RLimitCPU 60 100

so that your system is always under control and you can rely on your
error logs.

Secondly you may want to enable core-dumping so you can get a core of
the PHP module eating that much (so you can see which of your PHP
scripts is doing that).

	CoreDumpDirectory /var/crash
	.. set ulimit -c ..
and then later do
	gdb /usr/lcoal/sbin/httpd /var/crash/httpd.1234.core

And there is obviously something misconfigured in your kernel you want to
look into - a userland process should never 'freeze' the machine for
20 minutes at the time :-)

If you installed PHP using packages you may want to clean them all out -
including dependencies like GD, and/or install them in one sequence - as
it is common for linux packages to get slightly out of sync API wise.
Dw.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache freezes system

Posted by "Klaas [xs4all.nl]" <kl...@xs4all.nl>.
Ricardo Manuel Oliveira wrote:
> Klaas [xs4all.nl] wrote:
> 

>> The problem I've encounterd is that from time to time an apache child 
>> is responsable for freezing the system for about 20 minutes.
> It'd look as if one of your php scripts is comsuming all that memory.
> 
> Set a MAX limit on the memory available to any apache process while 
> running php scripts, enable php logs and look for the guilty script 
> there. This configuration should be in a php.ini located somewhere 
> (/etc, /usr/local/lib, depending on your specific installation).

Been there, done that :) Mem limit for php scripts is 8MB with a max. 
ex. time of 30 secs (Debian defaults). Logging for PHP is on but when 
the server goes 'down' there is not a single clue for a guilty PHP page :(

The search continues...

Klaas

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache freezes system

Posted by Ricardo Manuel Oliveira <rm...@eurotux.com>.
Klaas [xs4all.nl] wrote:

> Hi group,
>
> After a few weeks of experimenting and asking for help in the 
> newsgroups  I finally decided to try my luck here :)
>
> The problem:
>
> I have a webserver, dual Intel-Xeon with 2GB of RAM, it's running 
> Debian  Sarge with kernel 2.6.8-smp (debian default kernel).
> I'm using Apache 1.3.33 with php 4.3.10-2
>
> The problem I've encounterd is that from time to time an apache child 
> is responsable for freezing the system for about 20 minutes.
> What happens: once or twice a day (or not at all) at completely random 
> times there's an apache child who's memory consumption runs wild. The 
> result: the system runs out of memory because of this process and that 
> results in the system load going sky-high. At that moment the kernel 
> oom-killer comes in action and after aproc. 20 minutes the system is 
> accesible again.
>
> The process I monitored used almost 70% (!) of the memory, but when I 
> traced that process in the server-status there is no reason why it 
> should use that amount of memory. Also there are no messages according 
> to this problem in the error.log (with logging on debug mode).
>
> Setting from the httpd.conf:
> MinSpareServers 10
> MaxSpareServers 20
> StartServers 5
> MaxClients 150
> MaxRequestsPerChild 10000 (I've tested also with 100, but there is no 
> difference)
>
> ps auxf output:
> root     11004  0.4  0.0 14048 1596 pts/0    S    Feb17   0:12 
> /usr/sbin/apache
> www-data 11005  0.7  0.6 24336 13308 pts/0   S    Feb17   0:20  \_ 
> /usr/sbin/apache
> www-data 11006  0.6  0.2 15392 5296 pts/0    S    Feb17   0:16  \_ 
> /usr/sbin/apache
> www-data 11007  0.9  0.2 16976 5664 pts/0    S    Feb17   0:24  \_ 
> /usr/sbin/apache
> www-data 11008  0.5  0.2 15800 4820 pts/0    S    Feb17   0:15  \_ 
> /usr/sbin/apache
> www-data 11009  0.5  0.2 15740 5648 pts/0    S    Feb17   0:15  \_ 
> /usr/sbin/apache
> www-data 11011  0.7  0.2 15692 4684 pts/0    S    Feb17   0:19  \_ 
> /usr/sbin/apache
> www-data 11012  1.1  0.2 15648 5428 pts/0    S    Feb17   0:31  \_ 
> /usr/sbin/apache
> www-data 11013  1.0 63.3 1763240 1314412 pts/0 S  Feb17   0:28  \_ 
> /usr/sbin/apache
>
> Anyone an idea how to fix this?

 It'd look as if one of your php scripts is comsuming all that memory.

Set a MAX limit on the memory available to any apache process while 
running php scripts, enable php logs and look for the guilty script 
there. This configuration should be in a php.ini located somewhere 
(/etc, /usr/local/lib, depending on your specific installation).

Regards,
 Ricardo Oliveira






> Klaas
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org