On 14 March 2011 10:55, Kamil Vašica <[email protected]> wrote:
> I have this problem: There is one django source which is shared by
> multiple apache vhosts. Each instance of django project has its own
> settings and .wsgi script. Every vhost's WSGIDaemonProcess runs under
> its own unique user.
>
> WSGI apache processes running under their users die randomly. When it
> happens, there is massive growth of apache www-data processes. It does
> not happen at vhost which runs on another IP addres than other vhosts.
>
> Do you have any idea why processes are dying? Thanks Kamil

Are you using Apache prefork MPM or worker MPM? What are the Apache
MPM configuration directives set to for the MPM being used?

If you are using prefork MPM and daemon processes are restarting and
take some time, especially with only single daemon process, then if
site has heavy load then Apache could spin up more processes to handle
the incoming requests if it sees that existing processes are all busy.

BTW, if you are delegating each virtual host to a distinct daemon
process and only one application is running in it as it seems, then
use:

  WSGIApplicationGroup %{GLOBAL}

instead of:

  WSGIApplicationGroup app_xxxxx_com

This way code runs in main interpreter. Some third party C extension
modules for Python don't work properly in sub interpreters and one
example of problems is crashes. Usually crashes are straight away, but
could also be on an infrequent basis.

What third party packages for Python are you using?

Also, are you by chance loading mod_php or mod_python into same
Apache? If you don't need them then don't. Even if do need mod_python,
it can sometimes cause problems with mod_wsgi if mod_python/Python
installation hasn't been done right.

Graham

> There runs, Python 2.5.2 and, libapache2-mod-wsgi 2.5-1~lenny1
>
> apache vhost config of one of virtual:
> -------------------------------------------------------
> <VirtualHost *:80>
>        ServerName xxxxx.com
>        ServerAlias www.xxxxx.com
>
>        WSGIApplicationGroup app_xxxxx_com
>        WSGIDaemonProcess xxxxx_com user=xxxxx_com group=xxxxx_com
> processes=1 threads=10 maximum-requests=1000 inactivity-timeout=100
> deadlock-timeout=100
>        WSGIProcessGroup xxxxx_com
>        Alias /media/ /srv/xxxxx_com/cgi-bin/project/media/
>        Alias /php/ /srv/xxxxx_com/cgi-bin/php/
>        Alias /downloads/ /srv/xxxxx_com/cgi-bin/project/downloads/
>        Alias /favicon.ico /srv/xxxxx_com/cgi-bin/project/media/
> favicon.ico
>        Alias /robots.txt /srv/xxxxx_com/cgi-bin/project/downloads/
> robots.txt
>        WSGIScriptAlias / /srv/xxxxx_com/cgi-bin/project_br.wsgi
>
>        ErrorLog /srv/xxxxx_com/log/error_xxxxx.log
>        LogLevel info
>        #CustomLog /srv/xxxxx_com/log/access_xxxxx.log combined
>        LogFormat "%h %l %u %t \"%r\" %>s %b PID%{pid}P THREAD%{tid}P
> \"%{Referer}i\" \"%{User-agent}i\"" combined_s_pid
>        CustomLog /srv/xxxxx_com/log/access_xxxxx.log combined_s_pid
> </VirtualHost>
>
>
>
> --------------------------------------------------------------------------
> Example of project.wsgi
> project_xxxxx.wsgi
> --------------------------------------------------------
> import os, sys
>
> sys.stdout = sys.stderr
>
> PATH_TO_PROJECT = os.path.dirname(sys._getframe().f_code.co_filename)
> + '/'
>
>
> for p in [PATH_TO_PROJECT + 'project/', PATH_TO_PROJECT]:
>    if not p in sys.path:
>        sys.path.append(p)
>
> os.environ['PATH_TO_PROJECT'] = PATH_TO_PROJECT
> os.environ['DJANGO_SETTINGS_MODULE'] = 'settings_it'
>
> from project import settings_it as settings
> try:
>    p = settings.DJANGO_PATH
> except AttributeError:
>    p = '/opt/django/trunk_%s/' % settings.DJANGO_REVISION
> if not p in sys.path:
>    sys.path.append(p)
>
> import django.core.handlers.wsgi
>
> _application = django.core.handlers.wsgi.WSGIHandler()
>
> def application(environ, start_response):
>    if environ['wsgi.url_scheme'] == 'https':
>        environ['HTTPS'] = 'on'
>    return _application(environ, start_response)
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/modwsgi?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to