4

I have a problem with my web application. Sometimes when people upload an image (seems to happen with large image only), I have mod_wsgi who crash with this message :

End of script output before headers: wsgi.py, referer:http:::...
Process 'wsgi' has died, restarting.
Process 'wsgi' terminated by signal 9

and so an internal error is raised.

Here is my wsgi file:

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

and here is the wsgi conf file

LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /opt/python/run/baselinenv
WSGISocketPrefix run/wsgi
WSGIRestrictEmbedded On

<VirtualHost *:80>

Alias /static/ /opt/python/current/app/static/
<Directory /opt/python/current/app/static/>
Order allow,deny
Allow from all
</Directory>


WSGIScriptAlias / /opt/python/current/app/wsgi.py


<Directory /opt/python/current/app/>
  Require all granted
</Directory>

WSGIDaemonProcess wsgi processes=1 threads=15 display-name=%{GROUP} \
  python-path=/opt/python/current/app:/opt/python/run/venv/lib/python2.7/site-packages user=wsgi group=wsgi \
  home=/opt/python/current/app
WSGIProcessGroup wsgi
</VirtualHost>

Do you know what is the problem and what I can do to solve it ?

Please note that I cannot migrate to nginx and gunicorn.

Thanks a lot

trnsnt
  • 133
  • 2
  • 6
  • What version of mod_wsgi are you using? Does your system run a monitor which will kill processes if they use too much memory? Have you monitored the memory usage of the processes to see if they are growing to a very large value? Can you upgrade to the latest mod_wsgi version and try again? – Graham Dumpleton Apr 16 '15 at 04:14
  • Hello, version I use is `mod24_wsgi-py27.x86_64, 3.4-8.14.amzn1`, I have tried to update, but it seems to be the last one. When monitoring with top, I do not see any over usage of memory :( – trnsnt Apr 16 '15 at 07:48
  • Set 'LogLevel info' in the Apache configuration. This will cause mod_wsgi to log messages about why daemon processes are being restarted. This ail show whether the kill -9 is coming about because of a restart somehow triggered by mod_wsgi, or some external monitoring service. So change the Apache log level and then capture mod_wsgi log messages leading up to and after the messages you originally quoted. – Graham Dumpleton Apr 17 '15 at 00:05
  • The messages I originally quoted were already with info log level. – trnsnt Apr 17 '15 at 13:52
  • Can you provide greater context from the log so it is possible to see messages before and after that point then related to that event in time? – Graham Dumpleton Apr 17 '15 at 20:54
  • Do you have settings.py file? Can you start python interactive session and run commands: from django.core.wsgi import get_wsgi_application application = get_wsgi_application() – Navern Apr 25 '15 at 10:12
  • You absoutely need to supply apache with an error log. – Some Linux Nerd Apr 27 '15 at 20:26

0 Answers0