On Fri, Oct 21, 2011 at 6:15 PM, Alpesh Gajbe <alpeshga...@gmail.com> wrote:
>
>  File "/usr/local/lib/python2.6/dist-packages/django/http/__init__.py",
> line 296, in read
>   return self._stream.read(*args, **kwargs)
>
> IOError: request data read error
>

tl;dr - the user got bored waiting, pressed 'stop' on their browser.

This means the users browser stopped sending information. When your
server is busy (fully loaded), incoming requests to Apache's listen
socket are queued up to whatever you have configured ListenBacklog to.
At the same time, the OS is doing you a favour by pre-reading the
request into memory (AcceptFilter).

When the request is finally handled by Apache (reaches the front of
the backlog queue), the request has been pre-read, and processes
through Apache until it is delivered to mod_wsgi. Django then attempts
to read the rest of the request (if there is any).

This point is the first time that the socket has been read from since
the request was accepted by the kernel, and if the user has pressed
'stop', then there will be an error when trying to read from the
socket, which will get raised as an IOError.

Actually, thinking about it, there are another couple of possibilities
as to how the user disconnected. Apache could have read the request,
but was waiting for a mod_wsgi thread/child to be available, and the
user pressed stop there. This is probably more likely on Linux, which
only has extremely primitive accept filters.

The important thing to take away is that if you get an IOError when
reading/writing from/to a client, then the user isn't connected to the
other end any-more. It's not a django bug, buy a faster web server, db
server, ISP or shard your users so that they spend less time waiting.

Cheers

Tom

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

Reply via email to