tornadoweb / tornadoweb/tornado
wsgi: HEAD raises "Tried to write more data than Content-Length"
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 22.2k
- Forks
- 5.6k
- Avg merge
- 3h 42m
- Merged PRs (30d)
- 16
Description
refers to:Running WSGI apps on Tornado servers, I deployed Django project to tornado server.
But It will raise HTTP 500 sometimes(can not control, and the 500 error is accidental), and while use
curl --head 127.0.0.1:8888
it will raise Exception:
ERROR:tornado.application:Uncaught exception HEAD / (127.0.0.1)
HTTPServerRequest(protocol='http', host='127.0.0.1:8888', method='HEAD', uri='/', version='HTTP/1.1', remote_ip='127.0.0.1', headers={'Host': '127.0.0.1:8888', 'User-Agent': 'curl/7.54.0', 'Accept': '*/*'})
Traceback (most recent call last):
File "/Users/xxx/.py3/lib/python3.6/site-packages/tornado/web.py", line 1446, in _execute
result = self.prepare()
File "/Users/xxx/.py3/lib/python3.6/site-packages/tornado/web.py", line 2706, in prepare
self.fallback(self.request)
File "/Users/xxx/.py3/lib/python3.6/site-packages/tornado/wsgi.py", line 304, in __call__
request.connection.write_headers(start_line, header_obj, chunk=body)
File "/Users/xxx/.py3/lib/python3.6/site-packages/tornado/http1connection.py", line 398, in write_headers
data += self._format_chunk(chunk)
File "/Users/xxx/.py3/lib/python3.6/site-packages/tornado/http1connection.py", line 410, in _format_chunk
"Tried to write more data than Content-Length")
tornado.httputil.HTTPOutputError: Tried to write more data than Content-Length
ERROR:tornado.access:500 HEAD / (127.0.0.1) 5.99ms
Django version: 1.11.7
Tornado version: 4.5.2
Python: 3.6.0
p.s. while degrade the Django version to 1.9.*, everything is ok.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the traceback locations in tornado/wsgi.py and tornado/http1connection.py, then reproduce the report with curl --head 127.0.0.1:8888 against the Django application. Compare behavior with Django 1.11.7 and 1.9.*, and consider the issue resolved when HEAD no longer produces HTTPOutputError or an HTTP 500 response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100