Is this reproducible, ie. happens every time? If it is and since it is on a publicly accessible box I might trouble you to give me access so I can investigate.
The one other time this issue has come up, and which triggered changing how timeouts handled, was an intermittent problem and not reproducible. If providing access is okay, contact me off list about it. Would really like to understand this one a bit better as is baffling me at present if it is the same issue as last time. Graham 2009/11/26 Iván <[email protected]>: > > > On Nov 24, 8:11 am, Graham Dumpleton <[email protected]> > wrote: >> 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 > > Hi Graham, thanks for the answers. > > I'll follow what you asked for in order: > > > The ErrorLog was set to info and the only line I get when using it in > daemon mode is (after graceful restart) > > [Wed Nov 25 13:00:18 2009] [error] [client 190.247.74.168] Premature > end of script headers: ses-estudio.wsgi > > if I run it in embedded mode I get: > > [Wed Nov 25 13:06:38 2009] [info] [client 190.247.74.168] mod_wsgi > (pid=7784, process='', application='sesestudio.com.ar|/ses'): Loading > WSGI script '/var/www/vhosts/sesestudio.com.ar/mindpulse/ses- > estudio.wsgi'. > > and it works fine. This is when I set "WSGISocketPrefix /var/run/wsgi" > if not I get: > > [Wed Nov 25 13:11:10 2009] [error] [client 190.247.74.168] (13) > Permission denied: mod_wsgi (pid=11290): Unable to connect to WSGI > daemon process 'sesestudio' on '/etc/httpd/logs/wsgi.12235.114.1.sock' > after multiple attempts. > > Maybe this is why I got confused earlier. > > > My python version is "Python 2.4.3" > >> ldd /usr/lib/httpd/modules/mod_wsgi.so > libpython2.4.so.1.0 => /usr/lib/libpython2.4.so.1.0 (0x0039c000) > libpthread.so.0 => /lib/libpthread.so.0 (0x0097c000) > libdl.so.2 => /lib/libdl.so.2 (0x001c4000) > libutil.so.1 => /lib/libutil.so.1 (0x00111000) > libm.so.6 => /lib/libm.so.6 (0x00134000) > libc.so.6 => /lib/libc.so.6 (0x001c8000) > /lib/ld-linux.so.2 (0x00ab4000) > > > It takes around 20 seconds to appear and my apache Timeout is set to > 20! I've tried changing it to 40 and now it's around 42 seconds... I > guess my mississippies are a bit off xD What else should I try? Thanks > a lot, > Iván > > -- > > 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.
