Opened 4 years ago

Closed 4 years ago

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

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

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

  • Keywords wsgi added
  • Triage Stage changed from Unreviewed to Accepted

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

  • Resolution set to duplicate
  • Status changed from new to closed

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 3 years ago by jacob

  • milestone 1.4 deleted

Milestone 1.4 deleted

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