Thanks for your response. Sorry I didn't respond earlier--been quite
busy.

I don't know for certain that anyone's seeing a 500 response--I get an
e-mail from Django (traceback below) and an error in the Apache logs
(below).  I've never received an actual error report from a user (and
most of my users aren't the most technically inclined...) so I don't
know what they see.

I've never been able to duplicate this myself; it happens on average
once or twice a week, although it seems to occasionally happen to the
same person a couple of times within the span of a few minutes.  Also,
mod_wsgi is configured in daemon mode, with 1 process and 1 thread, if
that matters.

I haven't had a chance to try the debugging recipe you provided yet;
it's a production site, so I'm rather loathe to mess with it, if I can
avoid it.  Not to say that I won't try that, if it comes to it.
Thanks.

Apache log and traceback (both anonymized):

[Sat May 16 21:54:10 2009] [error] [client 75.33.xx.xx] (70014)End of
file found: mod_wsgi (pid=25650): Unable to get bucket brigade for
request., referer: https://domain.com/account/store/178/manage/item/create/
[Sat May 16 17:54:10 2009] [error] [client 75.33.xx.xx] mod_wsgi
(pid=18243): Exception occurred processing WSGI script '/var/www/
domain.com/django.wsgi'.
[Sat May 16 17:54:10 2009] [error] [client 75.33.xx.xxx] IOError:
client connection closed

(ignore the time difference--the server is on GMT, but Django is on
EST)

Traceback (most recent call last):

 File "/var/lib/python-support/python2.5/django/core/handlers/
base.py", line 86, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/var/www/domain.com/domain/djangologging/decorators.py", line
10, in decorated
   response = func(*args, **kwargs)

 File "/var/www/domain.com/domain/store/views.py", line 137, in
random_items_ajax
   if not request.POST or 'count' not in request.POST:

 File "/var/lib/python-support/python2.5/django/core/handlers/
wsgi.py", line 169, in _get_post
   self._load_post_and_files()

 File "/var/lib/python-support/python2.5/django/core/handlers/
wsgi.py", line 149, in _load_post_and_files
   self._post, self._files = http.QueryDict(self.raw_post_data,
encoding=self._encoding), datastructures.MultiValueDict()

 File "/var/lib/python-support/python2.5/django/core/handlers/
wsgi.py", line 203, in _get_raw_post_data
   size=content_length)

 File "/var/lib/python-support/python2.5/django/core/handlers/
wsgi.py", line 69, in safe_copyfileobj
   buf = fsrc.read(min(length, size))

IOError: request data read error


<WSGIRequest
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
COOKIES:{'sessionid': 'xxx'},
META:{'CONTENT_LENGTH': '7',
 'CONTENT_TYPE': 'application/x-www-form-urlencoded; charset=UTF-8',
 'DOCUMENT_ROOT': '/var/www/domain.com/domain/www',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': '*/*',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_ACCEPT_LANGUAGE': 'en-us',
 'HTTP_CACHE_CONTROL': 'no-cache',
 'HTTP_CONNECTION': 'Keep-Alive',
 'HTTP_COOKIE': 'sessionid=xxx',
 'HTTP_HOST': 'domain.com',
 'HTTP_REFERER': 'http://domain.com/page/how_to_sell/',
 'HTTP_USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT
6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506;
yie8)',
 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
 'PATH': '/usr/local/bin:/usr/bin:/bin',
 'PATH_INFO': u'/ajax/random_items/',
 'PATH_TRANSLATED': '/var/www/domain.com/django.wsgi/ajax/
random_items/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': 'xx.xx.xx.xx',
 'REMOTE_PORT': '50355',
 'REQUEST_METHOD': 'POST',
 'REQUEST_URI': '/ajax/random_items/',
 'SCRIPT_FILENAME': '/var/www/domain.com/django.wsgi',
 'SCRIPT_NAME': u'',
 'SCRIPT_URI': 'http://domain.com/ajax/random_items/',
 'SCRIPT_URL': '/ajax/random_items/',
 'SERVER_ADDR': 'xx.xx.xx.xx',
 'SERVER_ADMIN': '[no address given]',
 'SERVER_NAME': 'domain.com',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SIGNATURE': '<address>Apache/2.2.9 (Ubuntu) mod_ssl/2.2.9
OpenSSL/0.9.8g mod_wsgi/2.3 Python/2.5.2 Server at domain.com Port 80</
address>\n',
 'SERVER_SOFTWARE': 'Apache/2.2.9 (Ubuntu) mod_ssl/2.2.9 OpenSSL/
0.9.8g mod_wsgi/2.3 Python/2.5.2',
 'mod_wsgi.application_group': 'domain.com|',
 'mod_wsgi.callable_object': 'application',
 'mod_wsgi.listener_host': '',
 'mod_wsgi.listener_port': '80',
 'mod_wsgi.process_group': 'domain.com',
 'mod_wsgi.reload_mechanism': '1',
 'mod_wsgi.script_reloading': '1',
 'wsgi.errors': <mod_wsgi.Log object at 0x55555878e8d0>,
 'wsgi.file_wrapper': <built-in method file_wrapper of
mod_wsgi.Adapter object at 0x5555591e1b70>,
 'wsgi.input': <mod_wsgi.Input object at 0x55555900ef70>,
 'wsgi.multiprocess': True,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>


Thanks a lot,
Jeff

On May 21, 10:47 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> On May 22, 12:31 pm, Jeff FW <jeff...@gmail.com> wrote:
>
>
>
> > I've had the same problem, and can't figure out how to resolve it.  It
> > seems to have nothing to do with the amount of data being transfered:
> > it happens occasionally on the smallest of page requests/responses.
> > It also doesn't seem to be related to browser, unless several
> > different versions of IE *and* Safari have the same problem.  I tried
> > disabling keepalives for Safari at least, and it doesn't seem to have
> > helped.  I'd prefer not to disable keepalives in general, if I can
> > avoid it.
>
> > All of the error messages I've received have shown in the traceback
> > that they're coming through this 
> > function:http://code.djangoproject.com/browser/django/trunk/django/core/handle...
>
> > It seems to me like there's an easy workaround (I'm sure the actual
> > fix has to be much lower level, in WSGI or Apache [or even lower])
> > that would at least stop my users from getting 500 errors: wrap the
> > contents of that function in a try block, and *don't* raise the
> > exception.
>
> > Otherwise, I'd have to wrap every view that uses POST in that, which
> > would be very annoying.  Or maybe write middleware that just peeks at
> > POST before anything else gets it, so that I could catch it there.
>
> > Thoughts?
>
> If clients are actually see a 500 error response, at least means that
> return part of socket connection hasn't been closed. Is that want you
> really meant, or is the 500 error in the logs and clients get a blank
> page.
>
> If you could duplicate it, which it seems you can't, I would have
> suggested using second recipe in:
>
>  http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Tracking_Re...
>
> to try and capture request content and response to see how much of the
> request is actually being received.
>
> BTW, are you using mod_wsgi embedded mode or daemon mode?
>
> Also post an actual example traceback and what errors you get in the
> Apache error log just to validate the nature of the problem.
>
> Graham
>
> > Thanks,
> > Jeff
>
> > On Mar 31, 6:40 pm, Graham Dumpleton <graham.dumple...@gmail.com>
> > wrote:
>
> > > On Apr 1, 1:34 am, akaihola <akaih...@gmail.com> wrote:
>
> > > > We ran into the same issue Chunlei Wu described in January[1]. A user
> > > > was trying to upload large files and all we got were 500 errors by e-
> > > > mail:
>
> > > >   File "/home/citedesarts/src/django/django/http/multipartparser.py",
> > > > line 406, inread
> > > >IOError:requestdatareaderror
>
> > > > The user was on a public library computer with IE7. We're running
> > > > Apache 2.2.9 andmod_wsgi2.3 as packaged in Debian 5.0 Lenny.
>
> > > > I'm wondering about the HTTP_VIA header, could that have contributed
> > > > to the problem?
>
> > > The presence of the header itself is not likely to cause the issue,
> > > but its presence does indicate that therequestwent via a proxy or
> > > other sort of software. That proxy may have been killing off requests
> > > which took too long.
>
> > > The basic problem remains that the connection to the HTTP server was
> > > dropped before alldatacould beread.
>
> > > Graham
>
> > > > [1]http://groups.google.fi/group/django-users/browse_thread/thread/
> > > > 946936f69c012d96
>
> > > > ----
>
> > > > Below is the WSGIRequest dump from the 500 e-mail:
>
> > > > <WSGIRequest
> > > > GET:<QueryDict: {}>,
> > > > POST:<could not parse>,
> > > > COOKIES:{'sessionid': '83bc617fed936487b17f7d14848d245c'},
> > > > META:{'CONTENT_LENGTH': '30977474',
> > > >  'CONTENT_TYPE': 'multipart/form-data;
> > > > boundary=---------------------------7d9c0903da',
> > > >  'DOCUMENT_ROOT': '/home/mysite/media',
> > > >  'GATEWAY_INTERFACE': 'CGI/1.1',
> > > >  'HTTP_ACCEPT': 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
> > > > application/x-shockwave-flash, application/vnd.ms-excel, application/
> > > > vnd.ms-powerpoint, application/msword, */*',
> > > >  'HTTP_ACCEPT_LANGUAGE': 'fi',
> > > >  'HTTP_CACHE_CONTROL': 'no-cache',
> > > >  'HTTP_CONNECTION': 'Keep-Alive',
> > > >  'HTTP_COOKIE': 'sessionid=83bc617fed936487b17f7d14848d245c',
> > > >  'HTTP_HOST': 'mysite.com',
> > > >  'HTTP_REFERER': 'http://mysite.com/myform/',
> > > >  'HTTP_UA_CPU': 'x86',
> > > >  'HTTP_USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT
> > > > 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)',
> > > >  'HTTP_VIA': '1.1 EDUISAIMA',
> > > >  'PATH': '/usr/local/bin:/usr/bin:/bin',
> > > >  'PATH_INFO': u'/myform/',
> > > >  'PATH_TRANSLATED': '/home/mysite/deploy/mysite/myform/',
> > > >  'QUERY_STRING': '',
> > > >  'REMOTE_ADDR': '194.xxx.xxx.xxx',
> > > >  'REMOTE_PORT': '26205',
> > > >  'REQUEST_METHOD': 'POST',
> > > >  'REQUEST_URI': '/myform/',
> > > >  'SCRIPT_FILENAME': '/home/mysite/deploy/mysite.wsgi',
> > > >  'SCRIPT_NAME': u'',
> > > >  'SERVER_ADDR': '78.xxx.xxx.xxx',
> > > >  'SERVER_ADMIN': 'ad...@mysine.com',
> > > >  'SERVER_NAME': 'mysite.com',
> > > >  'SERVER_PORT': '80',
> > > >  'SERVER_PROTOCOL': 'HTTP/1.1',
> > > >  'SERVER_SIGNATURE': '<address>Apache/2.2.9 (Debian)mod_wsgi/2.3
> > > > Python/2.5.2 Server at mysite.com Port 80</address>\n',
> > > >  'SERVER_SOFTWARE': 'Apache/2.2.9 (Debian)mod_wsgi/2.3 Python/2.5.2',
> > > >  'mod_wsgi.application_group': 'mysite.com|',
> > > >  'mod_wsgi.callable_object': 'application',
> > > >  'mod_wsgi.listener_host': '',
> > > >  'mod_wsgi.listener_port': '80',
> > > >  'mod_wsgi.process_group': 'mysite',
> > > >  'mod_wsgi.reload_mechanism': '1',
> > > >  'mod_wsgi.script_reloading': '1',
> > > >  'wsgi.errors': <mod_wsgi.Log object at 0x2c3df90>,
> > > >  'wsgi.file_wrapper': <built-in method file_wrapper ofmod_wsgi.Adapter 
> > > > object at 0x24aeeb8>,
> > > >  'wsgi.input': <mod_wsgi.Input object at 0x2fb98f0>,
> > > >  'wsgi.multiprocess': True,
> > > >  'wsgi.multithread': True,
> > > >  'wsgi.run_once': False,
> > > >  'wsgi.url_scheme': 'http',
> > > >  'wsgi.version': (1, 0)}>
--~--~---------~--~----~------------~-------~--~----~
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