Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#15890 closed Bug (duplicate)

uWsgi + empty POST request causes Django to hang/crash

Reported by: brendoncrawford Owned by: nobody
Component: HTTP handling Version: 1.3
Severity: Normal Keywords: wsgi
Cc: django@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Tested with uWsgi 0.9.7.2, which is currently the latest stable.

Submitting a POST request with no parameters will for some reason cause django to hang and/or crash. This bug does not occur when using runserver, so it seems to be a problem with the Django WSGI handler.

Change History (4)

comment:1 by Alex Gaynor, 13 years ago

I've never seen any report like this with any other WSGI server, so I think it's significantly more likely it's an issue in uWSGI, can you create some sort of reproducible test case without uWSGI?

comment:2 by vung, 13 years ago

Keywords: wsgi added
Triage Stage: UnreviewedAccepted

In uWSGI, environ['wsgi.input'] is a file object.

At some point Django calls read() on it without providing a size argument and blocks.

Here's a minimal example without uWSGI:

import sys
from django.conf import settings
settings.configure(DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3'}})
from django.test.client import RequestFactory


extra = {
    'CONTENT_LENGTH': 0,
    'wsgi.input': sys.stdin,
}
request = RequestFactory().post('/', content_type='application/x-www-form-urlencoded', **extra)

# Blocks instead of printing False:
print 'a' in request.POST

This doesn't happen after applying the patch in #15785.

comment:3 by Aymeric Augustin, 13 years ago

Resolution: duplicate
Status: newclosed

This appears to be a consequence of the problem described in #15785.

The latest patch on that ticket is marked as RFC and vung verified that it fixes this one too.

So I am going to close as duplicate.

comment:4 by Jacob, 12 years ago

milestone: 1.4

Milestone 1.4 deleted

Note: See TracTickets for help on using tickets.
Back to Top