I'm running Apache 2.2.12 with mod_wsgi, hosting a Django site. Most of the apache child processes weigh in at about 125MB RSS, but occasionally I see one child balloon to > 1GB RSS.

At this point there's usually 1 huge process (>1GB), a couple of large ones (>500MB) and the rest are still ~125MB. These are the mod_wsgi daemon processes.

I've tried using memory leak tracing in Python to see if it's the Django code, and I see no leaks. Looking in the logs doesn't show any particularly strange requests.

I'm stumped on how to figure out what's causing this - any ideas? Also, any workaround ways to kill the large apache process when it gets too big, without bringing apache down?

Some more details:

  • Not using mod_php
  • Using pre-fork
link|improve this question
feedback

3 Answers

pmap -x pidofprocess

You can kill an apache child, but, that isn't a great solution. Are you also running with mod_php? mpm-prefork?

link|improve this answer
pmap just shows one large anonymous allocation. No clue there. – Malcolm Box Sep 20 '10 at 10:22
feedback

Maybe this will help: http://serverfault.com/questions/180902/preventing-django-app-from-causing-linux-box-to-run-out-memory/181184#181184

link|improve this answer
Thanks for the link, but it talks about Apache + prefork MPM's ability to create a lot of fat Python processes - which then blows through available memory. My problem isn't that - I have a limited number of processes, but one of the grows to a ridiculous size. – Malcolm Box Sep 24 '10 at 16:41
You probably using embedded mode instead of mod_wsgi daemon mode, which is not recommended to running production sites. – sumar Sep 24 '10 at 18:39
Definitely Daemon mode - the relevant line is WSGIDaemonProcess livetalkback.com processes=20 threads=1 python-eggs=/var/www/.python-eggs maximum-requests=1000 – Malcolm Box Sep 26 '10 at 8:31
feedback

Use mod_status with ExtendedStatus On and see what that specific PID is doing.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.