Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running django with mod_wsgi and every thing works fine most of the time but at times I observe that all of sudden Apache stops serving any requests, monitoring service on server says httpd is still running but requests take too long and fails with premature script headers.

I am running this setup on RHEL with python 2.6

wsgi directives

WSGISocketPrefix /var/run/wsgi
WSGIScriptAlias / /srv/bin/bootstrap.wsgi
WSGIDaemonProcess bstapp user=django-user group=django-user
WSGIProcessGroup bstapp
share|improve this question
1  
Any interesting in error log? –  quanta Aug 8 '12 at 7:50
    
Nothing interesting in error logs, it happens randomly and I don't see any pattern either which causes this. BTW I don't understand the negative vote to this question :-p –  vishy Aug 8 '12 at 8:04
add comment

1 Answer 1

That you are getting 'premature script headers' indicates to me you are using daemon mode. It would still help though if you amend your question and add at the end the specific mod_wsgi configuration you are using so it is clear what you are doing rather than having to guess.

Now, that you get 'premature script headers' also tends to indicate that your daemon processes are crashing. You should look in the main Apache error log to see if there is any log messages about 'segementation violation' or similar. Also set Apache LogLevel to 'info' at least, rather than 'warn'. That will make mod_wsgi log more about what is going on and why it thought the daemon process are exiting.

If it is a crash, and you only have the one WSGI application running in the daemon process group, then set:

WSGIApplicationGroup %{GLOBAL}

This will avoid various problems caused by third party Python packages which use a C extension component where the C extension component has not been implemented properly to work in sub interpreters. This may solve the crashing, but also if the extension module is dead locking and cause thread starvation as a result, that can also fix issues with the application appearing to no longer handle requests.

So, add that confguration to your question and change LogLevel to get more messages out of mod_wsgi. Finally force the use of the main interpreter using that directive.

share|improve this answer
    
I don't see the segmentation error in error log as I mentioned earlier this is not so frequent occurrence but once it occurs it makes Apache totally unresponsive. I will try the suggestions mentioned and share the results. –  vishy Aug 8 '12 at 9:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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