First time here? Check out the FAQ!
0

Why there are issues with mod_wsgi, when runserver works?

I have been trying to get askbot to work on my local server as a deployed project with out luck. Just to state, I have a number of Django projects that I run, so I am familiar with Django and deploying. My system:

Ubunut 12.04 (64bit) python 2.7.3

EDIT: when running from django, i.e. python manage.py runserver it appears to run fine with my limited testing.

With respect to deploying askbot I have tried many permutations, but lets start from the basic pip install askbot. I follow askbot documentation instructions for install, config, deploy with default settings. The site runs and I can log in etc., the issue is that once it is deployed the site will always hang and crash at some point when I am testing it by asking/answering questions. I believe it has something to do with mod_wsgi. The following are two different cases from my apache error log.

First example:

[Sat Nov 17 11:16:06 2012] [info] mod_wsgi (pid=28541): Daemon process deadlock timer expired, stopping process 'askbot3'.
[Sat Nov 17 11:16:06 2012] [info] mod_wsgi (pid=28541): Shutdown requested 'askbot3'.
[Sat Nov 17 11:16:11 2012] [info] mod_wsgi (pid=28541): Aborting process 'askbot3'.
[Sat Nov 17 12:16:11 2012] [error] [client 127.0.0.1] Premature end of script headers: django.wsgi, referer: http://sodiioo.media.mit.edu/account/signin/
[Sat Nov 17 12:16:11 2012] [error] [client 127.0.0.1] Premature end of script headers: django.wsgi, referer: http://sodiioo.media.mit.edu/account/signin/
[Sat Nov 17 12:16:11 2012] [debug] mod_deflate.c(615): [client 127.0.0.1] Zlib: Compressed 625 to 384 : URL /forum/questions/ask/, referer: http://127.0.0.1/forum/questions/ask/
[Sat Nov 17 12:16:11 2012] [info] mod_wsgi (pid=11144): Attach interpreter ''.
[Sat Nov 17 12:16:11 2012] [info] mod_wsgi (pid=11144): Shutdown requested 'askbot2'.
[Sat Nov 17 12:16:11 2012] [info] mod_wsgi (pid=11144): Stopping process 'askbot2'.
[Sat Nov 17 12:16:11 2012] [info] mod_wsgi (pid=11144): Destroying interpreters.
[Sat Nov 17 12:16:11 2012] [info] mod_wsgi (pid=11144): Cleanup interpreter ''.
[Sat Nov 17 12:16:11 2012] [info] mod_wsgi (pid=11144): Terminating Python.
[Sat Nov 17 12:16:11 2012] [info] mod_wsgi (pid=11144): Python has shutdown.
[Sat Nov 17 12:16:11 2012] [notice] caught SIGTERM, shutting down

[Sat Nov 17 12:16:12 2012] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Nov 17 12:16:12 2012] [warn] mod_wsgi: Runtime using Python/2.7.3.

Second example:

[Sat Nov 17 13:29:16 2012] [info] mod_wsgi (pid=5964): Daemon process deadlock timer expired, stopping process 'askbot3'.
[Sat Nov 17 13:29:16 2012] [info] mod_wsgi (pid=5964): Shutdown requested 'askbot3'.
[Sat Nov 17 13:29:21 2012] [info] mod_wsgi (pid=5964): Aborting process 'askbot3'.
[Sat Nov 17 14:29:21 2012] [error] [client 127.0.0.1] Premature end of script headers ...
(more)
esse's avatar
23
esse
asked 2012-11-17 13:45:35 -0500
Evgeny's avatar
13.2k
Evgeny
updated 2012-11-18 12:10:35 -0500
edit flag offensive 0 remove flag close merge delete

Comments

Does it work differently when you use the django runserver?

Evgeny's avatar Evgeny (2012-11-17 13:52:37 -0500) edit

When running via django runserver it appears to work fine. That is I have not had any hanging issues while running via django server.

esse's avatar esse (2012-11-17 14:06:18 -0500) edit

In that case it's unlikely to be due to a bug in askbot. Do versions of python for which mod_wsgi was built and your python version match?

Evgeny's avatar Evgeny (2012-11-17 14:13:42 -0500) edit

The apache log states mod_wsgi compiled for python 2.7.2+, my system python is 2.7.3. I have libapache2-mod 3.3-4build1 installed.

esse's avatar esse (2012-11-17 14:20:41 -0500) edit

Any suggestions?

esse's avatar esse (2012-11-18 10:07:42 -0500) edit
add a comment see more comments

1 Answer

0

My best guess is that you have either binary incompatibility between python and mod_wsgi or errors in the configuration.

For example python paths may be different in your development and production environments - this can be tested by inserting the following at the top of your settings.py file:

import sys
sys.stderr.write('\n'.join(sorted(sys.path)) + '\n')

Then compare the outputs in your error log (in the production case) or the console (for the runserver).

It may be useful to set the log levels to "debug" in apache and askbot. Have a look at the relevant documentation about WSGIDaemonProcess and WSGIProcessGroup mod_wsgi directives.

Evgeny's avatar
13.2k
Evgeny
answered 2012-11-18 11:30:29 -0500
edit flag offensive 0 remove flag delete link

Comments

Thanks for pointing me in the right direction. It was a combination of python path and Apache mod_wsgi variables not being set correctly. Things are working well so far. Thanks.

esse's avatar esse (2012-11-19 21:42:51 -0500) edit
add a comment see more comments