I have a Django app running under mod_wsgi on Windows. The app is a
simple web service -- it takes a request (optionally with some JSON in
the POST payload) and returns some JSON. Request A is generated from
a batch process that reads a file and makes periodic requests to the
Django app. Request B can be run from a browser and just returns some
JSON. Each request takes a few seconds to complete, so its easy to
get overlapping requests.
When running through WSGI, either request runs fine by itself. But if
I have the batch job running and kicking off Request A periodically,
and I kick of Request B from a browser, the process kicking off
Request A immediately reports a web error, saying the connection has
been forcibly closed by the remote host. In addition, the browser
running Request B reports a 500 error. In the Apache error logs, I
see:
[Mon Feb 01 00:04:42 2010] [notice] Parent: child process exited with
status 3221225477 -- Restarting.
[Mon Feb 01 00:04:42 2010] [notice] Apache/2.2.11 (Win32) mod_wsgi/2.6
Python/2.6.2 configured -- resuming normal operations
[Mon Feb 01 00:04:42 2010] [notice] Server built: Dec 10 2008 00:10:06
[Mon Feb 01 00:04:42 2010] [notice] Parent: Created child process 944
[Mon Feb 01 00:04:42 2010] [notice] Child 944: Child process is
running
[Mon Feb 01 00:04:42 2010] [notice] Child 944: Acquired the start
mutex.
[Mon Feb 01 00:04:42 2010] [notice] Child 944: Starting 64 worker
threads.
[Mon Feb 01 00:04:42 2010] [notice] Child 944: Starting thread to
listen on port 80.
If I run the Django app on it's own (python manage.py runserver
"192.168.0.32:80"), the requests complete properly. They seem to be
single-threaded (and slow, for that reason), but they work.
Versions:
python: 2.6.2
mod_wsgi: mod_wsgi-win32-ap22py26-2.6.so (I also tried with mod_wsgi-
win32-ap22py26-3.0.so and got the same result)
Django: 1.1
Windows: Windows Server 2008, 32-bit.
What else would folks want to know? Here's my django.wsgi script:
import os
import sys
sys.path.append("c:/foobar")
sys.path.append("c:/foobar/foobar_service")
sys.path.append("c:/python26/lib/site-packages/xlrd-0.7.1-py2.6-
win32.egg")
os.environ['DJANGO_SETTINGS_MODULE'] = 'fabx_service.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
And here's the VirtualHost configuration from httpd.conf:
NameVirtualHost *
<VirtualHost *>
ServerAdmin [email protected]
ServerName foobar.example.com
ServerAlias foobar
DocumentRoot "c:/foobar"
ErrorLog "c:/program files/apache software foundation/apache2.2/logs/
foobar_error.log"
customLog "c:/program files/apache software foundation/apache2.2/
logs/foobar_access.log" common
WSGIScriptAlias / "C:/foobar/foobar_service/apache/django.wsgi"
<Directory "c:/foobar">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Is there anything in this morass of configuration that is clearly
wrong? Can anyone suggest where I might look next to figure out how
to run multiple parallel requests through mod_wsgi?
--
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.