2

i've got a problem with apache. When i try to start it (/etc/init.d/apache2 start) it dies after a few seconds. It shows up on "ps aux" consuming a lot of memory and then dies. I don't know what could be causing apache to consume this amount of memory:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root     13379  1.0  0.3  14376  3908 ?        Ss   22:31   0:00 /usr/sbin/apache2 -k start
www-data 13383  0.0  0.4 197316  4196 ?        Sl   22:31   0:00 /usr/sbin/apache2 -k start
www-data 13390  0.0  0.3 172728  4172 ?        Sl   22:31   0:00 /usr/sbin/apache2 -k start
www-data 13396  0.0  0.3 156336  4160 ?        Sl   22:31   0:00 /usr/sbin/apache2 -k start
www-data 13400  0.0  0.3 148140  4156 ?        Sl   22:31   0:00 /usr/sbin/apache2 -k start
www-data 13403  0.0  0.3 131748  4148 ?        Sl   22:31   0:00 /usr/sbin/apache2 -k start

Here is a htop screenshot:

https://i.stack.imgur.com/N4Chh.png

It happened suddenly, no change had been made to server config, so i don't know whats causing it. The error log of my virtual servers shows this:

[Sun Jan 30 22:19:50 2011] [alert] (11)Resource temporarily unavailable: mod_wsgi (pid=9685): Couldn't create worker thread 11 in daemon process 'fb.ebookmetafinder.com'.
[Sun Jan 30 22:19:55 2011] [alert] (11)Resource temporarily unavailable: mod_wsgi (pid=9685): Couldn't create worker thread 19 in daemon process 'fb.ebookmetafinder.com'.
[Sun Jan 30 22:29:40 2011] [alert] (11)Resource temporarily unavailable: mod_wsgi (pid=12009): Couldn't create worker thread 18 in daemon process 'fb.ebookmetafinder.com'.
[Sun Jan 30 22:31:06 2011] [alert] (11)Resource temporarily unavailable: mod_wsgi (pid=13396): Couldn't create worker thread 15 in daemon process 'fb.ebookmetafinder.com'.
[Sun Jan 30 22:35:02 2011] [alert] (11)Resource temporarily unavailable: mod_wsgi (pid=14009): Couldn't create worker thread 16 in daemon process 'fb.ebookmetafinder.com'.
[Sun Jan 30 22:35:07 2011] [alert] (11)Resource temporarily unavailable: mod_wsgi (pid=14009): Couldn't create worker thread 17 in daemon process 'fb.ebookmetafinder.com'.

I'm on a ubuntu server vps and i use mod_wsgi with django.

Thanks.

EDIT: After editing Apache mpm configuration as sugested by alvosu apache starts correctly and don't crash but it consumes all the free ram of my system to the point of making it unstable:

root@vps:~# ps
ps: error while loading shared libraries: libc.so.6: failed to map segment from shared object: Cannot allocate memory

This is the result of free -m with apache running:

             total       used       free     shared    buffers     cached
Mem:          1024       1022          1          0          0          0
-/+ buffers/cache:       1022          1
Swap:            0          0          0

And this without it:

             total       used       free     shared    buffers     cached
Mem:          1024        203        820          0          0          0
-/+ buffers/cache:        203        820
Swap:            0          0          0

I think apache shouldn't consume this amout of ram. I use apache to serve a dynamic pages and nginx for static one. I've got 4 virtual hosts on this server.

3
  • 1
    check the error log Jan 30, 2011 at 22:49
  • Did you update Apache and not recompile mod_wsgi against it, perhaps?
    – Andrew M.
    Jan 31, 2011 at 1:16
  • The error log is posted, all it says is: [Sun Jan 30 22:19:50 2011] [alert] (11)Resource temporarily unavailable: mod_wsgi (pid=9685): Couldn't create worker thread 11 in daemon process 'fb.ebookmetafinder.com'. I haven't update apache, it just started happening a couple of days ago.
    – Nacho
    Jan 31, 2011 at 19:13

1 Answer 1

1

Try edit Apache mpm configuration.

$apache2 -V | grep MPM Server MPM: Prefork

<IfModule mpm_prefork_module>
    StartServers          1
    MinSpareServers       1
    MaxSpareServers       5
    MaxClients            30
    ServerLimit           30
    MaxRequestsPerChild   5000
</IfModule>

$apache2 -V | grep MPM Server MPM: Worker

<IfModule mpm_worker_module>
    StartServers           2
    MaxClients            30
    MinSpareThreads       15
    MaxSpareThreads       20
    ThreadsPerChild       10
    MaxRequestsPerChild  5000
</IfModule>
5
  • But when i start apache, the memory bar usage on top gets full and it dies. here is the htop screenshot sorted by mem%: i.imgur.com/M6xsP.png
    – Nacho
    Jan 30, 2011 at 22:57
  • kill apache(#killall apache2) and make screenshot
    – alvosu
    Jan 30, 2011 at 23:01
  • here it is: i.imgur.com/NiHhG.png
    – Nacho
    Jan 30, 2011 at 23:10
  • try edit MPM specific
    – alvosu
    Jan 30, 2011 at 23:20
  • I edited the MPM config as you sugested, thanks, check the edit.
    – Nacho
    Jan 31, 2011 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .