tornadoweb / tornadoweb/tornado
StaticFileHandler block the whole application when downloading a large file
Open
Nobody has claimed this yet.
web
- Dominant language
- Python
- Stars
- 22.2k
- Forks
- 5.6k
- Avg merge
- 3h 42m
- Merged PRs (30d)
- 16
Description
Env: Tornado 6.1
When I download a 1GB file, the whole web application is blocked.
The code shows this await won't switch to other coroutines.
https://github.com/tornadoweb/tornado/blob/6cdf82e927d962290165ba7c4cccb3e974b541c3/tornado/web.py#L2648
after add
await asyncio.sleep(0)
the blocking-method dismissed.
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 in tornado/web.py at the StaticFileHandler code around line 2648, then inspect how the large-file download awaits its work. Reproduce a 1GB download alongside another request and verify that the application remains responsive while the file is served.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100