2009/11/24 Graham Dumpleton <[email protected]>: > 2009/11/24 Iván <[email protected]>: >> Hi, I can't make WSGi work on daemon mode. It works perfectly well >> with embed mode. I'm getting "Premature end of script headers: >> test.wsgi" in the error log. I've read the FAQ and >> ConfigurationIssues, and I think it's a sockets problem, but no idea >> how to solve it. >> >> I've tried "WSGISocketPrefix run/wsgi" and "WSGISocketPrefix /var/run/ >> wsgi" > > The premature end of script headers issue is not solved by fiddling > with WSGISocketPrefix. Not sure where you got that idea. The FAQ says: > > """Q: Why am I seeing the error message 'premature end of script > headers' in the Apache error logs. > > A: If using daemon mode, this is a symptom of the mod_wsgi daemon > process crashing when handling a request. You would probably also see > the message 'segmentation fault'. See answer for question about > 'segmentation fault' above. > > This error message can also occur where you haven't configured Apache > correctly and your WSGI script file is being executed as a CGI script > instead.""" > > So, no mention of the socket issues, which will manifest as totally > different problem. > >> and the sockets are being created but when I "ls -al" I get the >> following: >> >> drwxr-xr-x 21 root root 4096 Nov 23 18:05 .. >> .. >> srwx------ 1 apache root 0 Nov 23 18:24 wsgi.12235.25.1.sock" > > Which is perfectly fine from what I can see. > >> I've even tried "WSGISocketPrefix /tmp/wsgi"!!!! >> >> >> My config: >> CentOS >> Linux mindpulse.net 2.6.9-023stab051.2-enterprise #1 SMP Thu Sep 24 >> 23:38:21 MSD 2009 i686 i686 i386 GNU/Linux >> Server version: Apache/2.2.3 >> mod_wsgi 3.0 (compiled from source) >> running on mediatemple.net dv 3.5 (dedicated server) >> >> >> <vhost> >> WSGIDaemonProcess sesestudio user=sesestudio threads=10 display-name=% >> {GROUP} python-path=/var/www/vhosts/sesestudio.com.ar/mindpulse/ses- >> estudio/bootstrap/lib/python2.4/site-packages >> WSGIProcessGroup sesestudio >> WSGIScriptAlias /ses /var/www/vhosts/sesestudio.com.ar/mindpulse/ >> test.wsgi >> >> >> <test.wsgi> >> def application(environ, start_response): >> start_response('200 OK', [('content-Type', 'text/html')]) >> return ['Hello World'] >> >> >> When I comment WSGIDaemonProcess and WSGIProcessGroup it works >> flawlessly. What can I do to fix this?? Thanks in advance, > > What you need to do is set: > > LogLevel info > > in the Apache configuration and restart Apache. > > Tail the Apache error log file and make a request. > > Then capture all output in Apache error log file related to the > request and post it here. > > There are a couple of possibilities of why you are having problems as > documented. > > 1. You are loading mod_python at same time and one of the other is > using static library for Python causing daemon process to crash. > > 2. You have SELinux enabled and it is prohibiting daemon mode from > working properly. > > Lets start with the actual content of error log for the request, not > just a single extract as you quote, but all the lines triggered by the > request so can see them and comment. > > Also indicate what version of Python you are using. Your python-path > suggests 2.4, however if mod_wsgi not actually compiled against 2.4 > and you are forcing it to use 2.4 site-packages directory, that itself > can cause problems due to mixing of Python versions. > > As guide, post output from running: > > ldd mod_wsgi.so > > for compiled mod_wsgi module file.
Also, how long after you make the request does the 'Premature end of script headers' error message appear? There was a case where someone was getting behaviour that suggested their operating system was screwing up and thinking it had connected on UNIX socket where server side never saw the connection arrive. Tweaks were made in 3.0 to ensure default Apache timeout got triggered in this case to at least unblock the Apache process, which would have hung. It getting stuck and then recovering would have presented as 'Premature end of script headers' error. How long before that message would have come out would have been dictated by value of the Timeout directive in your Apache configuration. What do you have Timeout directive set to in Apache configuration? Have you fiddled it so it isn't the default 300 seconds? FWIW, that area of code in mod_wsgi hadn't changed for quite a long time. So, had to be operating system, with only other possibility being that Apache Runtime Library had been screwed up in some way. That or mod_wsgi was compiled against different APR to what was actually being used although that is probably unlikely. Graham -- 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.
