You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tomasz Chmielewski <ma...@wpkg.org> on 2009/02/28 15:37:39 UTC
[users@httpd] preforked processes don't want to die over time -> memory full
I have Apache 2.2.3 server, which over time (a couple of days) uses lots
of memory. What uses lots of memory? Apache processes which do not want
to die for some reason.
The server can have only 10-20 active connections to httpd (as reported
by netstat's ESTABLISHED), but in the same time, there can be 80, 100,
120 or more httpd processes (the longer httpd was not restarted, the
more httpd processes will run, till memory and swap are full and
OOM-killer will start to kill processes).
Short term, httpd processes are created and killed (exit), but longer
term, after several hours, I can see that more and more httpd processes
are running.
How can I trace what causes this misbehaviour? Perhaps it's some PHP
code which never exits.
I always used strace to check various malfunctioning, but I think it'd
be an overkill here, and perhaps there is a better way to check what
httpd processes were doing and how long did it take them.
It is prefork with pretty default settings:
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>
Apache comes from httpd-2.2.3-11.el5_2.centos.4 package from CentOS 5.2.
--
Tomasz Chmielewski
http://wpkg.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
Re: [users@httpd] preforked processes don't want to die over time
-> memory full
Posted by Tomasz Chmielewski <ma...@wpkg.org>.
Tomasz Chmielewski schrieb:
> I have Apache 2.2.3 server, which over time (a couple of days) uses lots
> of memory. What uses lots of memory? Apache processes which do not want
> to die for some reason.
>
> The server can have only 10-20 active connections to httpd (as reported
> by netstat's ESTABLISHED), but in the same time, there can be 80, 100,
> 120 or more httpd processes (the longer httpd was not restarted, the
> more httpd processes will run, till memory and swap are full and
> OOM-killer will start to kill processes).
>
> Short term, httpd processes are created and killed (exit), but longer
> term, after several hours, I can see that more and more httpd processes
> are running.
>
> How can I trace what causes this misbehaviour? Perhaps it's some PHP
> code which never exits.
> I always used strace to check various malfunctioning, but I think it'd
> be an overkill here, and perhaps there is a better way to check what
> httpd processes were doing and how long did it take them.
My issue looks very similar to the one described (and not solved) here:
http://www.webhostingtalk.com/showthread.php?t=670621
In short, stracing a httpd process stops on LOCK_EX:
$ strace -p 3230
06:57:12
open("/var/lib/php/session/sess_86ecf346c6f7adba93cb1077f6b95d43",
O_RDWR|O_CREAT,
0600) = 44
06:57:12 flock(44, LOCK_EX
And "lsof" shows that such session files are being accessed by many
httpd processes (each wanting to have an exclusive lock, which will
block all other instances).
Hmm, what should I do?
--
Tomasz Chmielewski
http://wpkg.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