We have a Django 1.3.1 application running with mod_wsgi 3.3 in daemon
mode on a OS X 10.6 development machine running Apache 2.2.21 with
Python 2.6.1. The daemon mode settings are 1 process, 15 threads with
send and receive buffers set to 5MB each.
On this development machine we are running in to a problem where the
application hangs/freezes occasionally when uploading a file to the
server using a multipart POST request. The test case gets the freeze
about 30% of the time. We currently cannot reproduce this on a Cent
OS server with the same code.
Through some painful debugging, I've traced the blocking problem down
to line 2218 in mod_wsgi.c in the Input_read method:
n = ap_get_client_block(self->r, buffer + length,
size - length);
The Input_read method is triggered from Django request.POST which
ultimately calls the wsgi.input read method requesting 25739 bytes
(same as CONTENT_LENGTH). This is the first time the method was
called on this request which means that the buffer should contain the
right amount of bytes.
When I print some of the variables before and after the offending
ap_get_client_block line, here's what I have when everything works
fine:
Input_read inside loop before getclientblock length 0, size 25739.
should client block 1
Input_read inside loop after getclientblock length 0, size 25739, n:
8000
Input_read inside loop before getclientblock length 8000, size 25739.
should client block 0
Input_read inside loop after getclientblock length 8000, size 25739,
n: 8000
Input_read inside loop before getclientblock length 16000, size 25739.
should client block 0
Input_read inside loop after getclientblock length 16000, size 25739,
n: 8000
Input_read inside loop before getclientblock length 24000, size 25739.
should client block 0
Input_read inside loop after getclientblock length 24000, size 25739,
n: 1739
Input_read before return length 25739, size 25739
Here's what happens just before it freezes:
Input_read inside loop before getclientblock length 0, size 25739.
should client block 1
Input_read inside loop after getclientblock length 0, size 25739, n:
562
Input_read inside loop before getclientblock length 562, size 25739.
should client block 0
>From this it appears it is blocking at byte 563.
Any idea what could be causing this to block here? Is there a bug
here with Apache? Any ideas would be appreciated.
Thanks!
--
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.