apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Stéphane Klein

Hi,

I use Pylons 1.0 Framework and mod_wsgi on production server.

I can use my application but randomly 1 request on 10 I've error :

Internal Server Error in browser and in error log file :

[client 82.231.115.1] Premature end of script headers: demo.wsgi, 
referer: http://example.com/


I've read already many documentation page about this issue on mod_wsgi 
and Pylons website.


Have you some idea about this error ?

More information about my configuration :

* I use apache2 from Debian package
* I've compiled Python 2.6 from source code
* I've compiled mod_wsgi-3.3 from source code (I've also tested with 
mod_wsgi-2.8, same error)


VirtualHost *:80
ServerName example.com

IfModule mod_wsgi.c

WSGIScriptAlias / /home/examplecom/demo/demo.wsgi
WSGIDaemonProcess mydemo threads=1 maximum-requests=500 
inactivity-timeout=500 processes=1 display-name=%{GROUP}

WSGIProcessGroup mydemo
WSGIApplicationGroup %{GLOBAL}

/IfModule

ErrorLog /home/examplecom/demo/error.log
LogLevel info

/VirtualHost

Thanks for your help.

Regards,
Stephane
--
Stéphane Klein steph...@harobed.org - French
blog: http://stephane-klein.info
twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com

--
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: [modwsgi] apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Graham Dumpleton
On 8 December 2010 20:37, Stéphane Klein steph...@harobed.org wrote:
 Hi,

 I use Pylons 1.0 Framework and mod_wsgi on production server.

 I can use my application but randomly 1 request on 10 I've error :

 Internal Server Error in browser and in error log file :

 [client 82.231.115.1] Premature end of script headers: demo.wsgi, referer:
 http://example.com/

Need to see the error messages before and after this and for matching
time in main Apache error log if you are using a virtual host specific
error log.

This message will arise in a few circumstances.

The first is that WSGI script file is being executed as a CGI script
for some reason.

The second is that the mod_wsgi daemon process is crashing.

The third is that daemon process is being forcibly restarted while
there are active requests which haven't responded in time.

 I've read already many documentation page about this issue on mod_wsgi and
 Pylons website.

 Have you some idea about this error ?

 More information about my configuration :

 * I use apache2 from Debian package
 * I've compiled Python 2.6 from source code
 * I've compiled mod_wsgi-3.3 from source code (I've also tested with
 mod_wsgi-2.8, same error)

 VirtualHost *:80
    ServerName example.com

    IfModule mod_wsgi.c

        WSGIScriptAlias / /home/examplecom/demo/demo.wsgi
        WSGIDaemonProcess mydemo threads=1 maximum-requests=500
 inactivity-timeout=500 processes=1 display-name=%{GROUP}

A very odd configuration.

You are running a single process with a single thread in it.

That it is a single thread only though, means that you can't be
incurring third possibility above though as a forced restart due to
maximum requests being reached as there can't be a concurrent request
that is being interrupted.

You can get a forced shutdown when request is still current due to
inactivity timeout if the request hangs for 500 seconds for your
configuration, but in that case I would say you would notice the hang
given that that is almost 10 minutes before that could kick in.

I would suggest so as to get more information if it is something
related to maximum requests or inactivity timeout, that you ensure
using:

  LogLevel info

in Apache configuration and not the default:

  LogLevel warn

Have a good look for segmentation fault messages in main Apache error
log as well.

Graham

        WSGIProcessGroup mydemo
        WSGIApplicationGroup %{GLOBAL}

    /IfModule

    ErrorLog /home/examplecom/demo/error.log
    LogLevel info

 /VirtualHost

 Thanks for your help.

 Regards,
 Stephane
 --
 Stéphane Klein steph...@harobed.org - French
 blog: http://stephane-klein.info
 twitter: http://twitter.com/klein_stephane
 pro: http://www.is-webdesign.com

 --
 You received this message because you are subscribed to the Google Groups
 modwsgi group.
 To post to this group, send email to modw...@googlegroups.com.
 To unsubscribe from this group, send email to
 modwsgi+unsubscr...@googlegroups.com.
 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 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Stéphane Klein

Le 08/12/2010 10:54, Graham Dumpleton a écrit :

On 8 December 2010 20:37, Stéphane Kleinsteph...@harobed.org  wrote:

Hi,

I use Pylons 1.0 Framework and mod_wsgi on production server.

I can use my application but randomly 1 request on 10 I've error :

Internal Server Error in browser and in error log file :

[client 82.231.115.1] Premature end of script headers: demo.wsgi, referer:
http://example.com/


Need to see the error messages before and after this and for matching
time in main Apache error log if you are using a virtual host specific
error log.

This message will arise in a few circumstances.



This is more information messages :

http://pastebin.com/myi5D5Xn

Regards,
Stephane
--
Stéphane Klein steph...@harobed.org - French
blog: http://stephane-klein.info
twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com

--
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Stéphane Klein

Le 08/12/2010 11:21, Stéphane Klein a écrit :

Le 08/12/2010 10:54, Graham Dumpleton a écrit :

On 8 December 2010 20:37, Stéphane Kleinsteph...@harobed.org wrote:

Hi,

I use Pylons 1.0 Framework and mod_wsgi on production server.

I can use my application but randomly 1 request on 10 I've error :

Internal Server Error in browser and in error log file :

[client 82.231.115.1] Premature end of script headers: demo.wsgi,
referer:
http://example.com/


Need to see the error messages before and after this and for matching
time in main Apache error log if you are using a virtual host specific
error log.

This message will arise in a few circumstances.



This is more information messages :

http://pastebin.com/myi5D5Xn


Well, I see the last message of this thread : 
http://groups.google.com/group/modwsgi/browse_thread/thread/ba82b2643564d2dd


He say :

Last night we installed mod_wsgi 3.3, and the KeyErrors have totally
disappeared.  I highly recommend the 3.3 upgrade if you're having this
problem.  Thanks, Graham.

In my test, I've tested mod_wsgi 3.3 and 2.8
In last log message, it's 2.8 version.

Now I've reinstalled 3.3 version, this is the new log messages :

http://pastebin.com/kKztWiCY

Regards,
Stephane
--
Stéphane Klein steph...@harobed.org - French
blog: http://stephane-klein.info
twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com

--
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Graham Dumpleton
Logs show the segmentation faults I speak of:

[Wed Dec 08 11:32:47 2010] [error] [client 82.231.115.1] Premature end
of script headers: demo.wsgi, referer: http://example.com/employees/
[Wed Dec 08 11:32:47 2010] [notice] child pid 22620 exit signal
Segmentation fault (11)

Attach gdb to daemon process as described in:

http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Debugging_Crashes_With_GDB

enter 'cont' command so runs again and then keep firing off requests
until it crashes.

Suggest removing maximum-requests during that time so that process
isn't restarted because of that number being exceeded.

In other words, debug why process is crashing.

For ideas of why, see:

http://code.google.com/p/modwsgi/wiki/FrequentlyAskedQuestions#Apache_Process_Crashes
http://code.google.com/p/modwsgi/wiki/ApplicationIssues

Graham

On 8 December 2010 21:37, Stéphane Klein steph...@harobed.org wrote:
 Le 08/12/2010 11:21, Stéphane Klein a écrit :

 Le 08/12/2010 10:54, Graham Dumpleton a écrit :

 On 8 December 2010 20:37, Stéphane Kleinsteph...@harobed.org wrote:

 Hi,

 I use Pylons 1.0 Framework and mod_wsgi on production server.

 I can use my application but randomly 1 request on 10 I've error :

 Internal Server Error in browser and in error log file :

 [client 82.231.115.1] Premature end of script headers: demo.wsgi,
 referer:
 http://example.com/

 Need to see the error messages before and after this and for matching
 time in main Apache error log if you are using a virtual host specific
 error log.

 This message will arise in a few circumstances.


 This is more information messages :

 http://pastebin.com/myi5D5Xn

 Well, I see the last message of this thread :
 http://groups.google.com/group/modwsgi/browse_thread/thread/ba82b2643564d2dd

 He say :

 Last night we installed mod_wsgi 3.3, and the KeyErrors have totally
 disappeared.  I highly recommend the 3.3 upgrade if you're having this
 problem.  Thanks, Graham.

 In my test, I've tested mod_wsgi 3.3 and 2.8
 In last log message, it's 2.8 version.

 Now I've reinstalled 3.3 version, this is the new log messages :

 http://pastebin.com/kKztWiCY

 Regards,
 Stephane
 --
 Stéphane Klein steph...@harobed.org - French
 blog: http://stephane-klein.info
 twitter: http://twitter.com/klein_stephane
 pro: http://www.is-webdesign.com


-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Stéphane Klein

Le 08/12/2010 11:52, Graham Dumpleton a écrit :

Logs show the segmentation faults I speak of:

[Wed Dec 08 11:32:47 2010] [error] [client 82.231.115.1] Premature end
of script headers: demo.wsgi, referer: http://example.com/employees/
[Wed Dec 08 11:32:47 2010] [notice] child pid 22620 exit signal
Segmentation fault (11)

Attach gdb to daemon process as described in:

http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Debugging_Crashes_With_GDB

enter 'cont' command so runs again and then keep firing off requests
until it crashes.



This is the debug message :

http://pastebin.com/q9Lb72vQ

Regards,
Stephane
--
Stéphane Klein steph...@harobed.org - French
blog: http://stephane-klein.info
twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com

--
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Graham Dumpleton
No clues unfortunately, just looks like arbitrary memory corruption.

Do make sure you aren't loading mod_python into same Apache.

Other than that, looks like a C extension module may be corrupting memory.

What C extension modules for Python are you using?

Graham

On 8 December 2010 22:14, Stéphane Klein steph...@harobed.org wrote:
 Le 08/12/2010 11:52, Graham Dumpleton a écrit :

 Logs show the segmentation faults I speak of:

 [Wed Dec 08 11:32:47 2010] [error] [client 82.231.115.1] Premature end
 of script headers: demo.wsgi, referer: http://example.com/employees/
 [Wed Dec 08 11:32:47 2010] [notice] child pid 22620 exit signal
 Segmentation fault (11)

 Attach gdb to daemon process as described in:


 http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Debugging_Crashes_With_GDB

 enter 'cont' command so runs again and then keep firing off requests
 until it crashes.


 This is the debug message :

 http://pastebin.com/q9Lb72vQ

 Regards,
 Stephane
 --
 Stéphane Klein steph...@harobed.org - French
 blog: http://stephane-klein.info
 twitter: http://twitter.com/klein_stephane
 pro: http://www.is-webdesign.com


-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Stéphane Klein

Le 08/12/2010 12:20, Graham Dumpleton a écrit :

No clues unfortunately, just looks like arbitrary memory corruption.

Do make sure you aren't loading mod_python into same Apache.


No, mod_python isn't installed.



Other than that, looks like a C extension module may be corrupting memory.

What C extension modules for Python are you using?


this is more information about library loading found with gdb :

http://pastebin.com/VFPe5BcK

There are some clues in this log ?

Regards,
Stephane

--
Stéphane Klein steph...@harobed.org - French
blog: http://stephane-klein.info
twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com

--
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Graham Dumpleton
On 9 December 2010 00:34, Stéphane Klein steph...@harobed.org wrote:
 Le 08/12/2010 12:20, Graham Dumpleton a écrit :

 No clues unfortunately, just looks like arbitrary memory corruption.

 Do make sure you aren't loading mod_python into same Apache.

 No, mod_python isn't installed.


 Other than that, looks like a C extension module may be corrupting memory.

 What C extension modules for Python are you using?

 this is more information about library loading found with gdb :

 http://pastebin.com/VFPe5BcK

 There are some clues in this log ?

Only notable things are:

Reading symbols from /usr/lib/libpq.so.5...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libpq.so.5
Reading symbols from /usr/lib/libmysqlclient_r.so.15...(no debugging
symbols found)...done.
Loaded symbols for /usr/lib/libmysqlclient_r.so.15
Reading symbols from /usr/lib/libsqlite3.so.0...(no debugging symbols
found)...done.
Loaded symbols for /usr/lib/libsqlite3.so.0
Reading symbols from /usr/lib/libexpat.so.1...(no debugging symbols
found)...done.
Loaded symbols for /usr/lib/libexpat.so.1
Reading symbols from /usr/lib/libxml2.so.2...(no debugging symbols
found)...done.
Loaded symbols for /usr/lib/libxml2.so.2

These are preloaded by Apache or PHP extensions.

If you are using any C extension module for Python which is expecting
different versions of these libraries, you can end up with problems.

If you can, don't load PHP into Apache and see if your problem goes away.

Recommended that you don't use mod_php and mod_wsgi in same Apache if
you can help it.

Graham

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.