Opened 7 years ago

Closed 7 years ago

Last modified 7 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:


Tested with uWsgi, 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 Changed 7 years ago by Alex Gaynor

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 Changed 7 years ago by vung

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 = {
    '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 Changed 7 years ago by Aymeric Augustin

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 Changed 7 years ago by Jacob

milestone: 1.4

Milestone 1.4 deleted

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