VIDA-NYU / reproserver

A web application reproducing ReproZip packages in the cloud.
https://server.reprozip.org/
BSD 3-Clause "New" or "Revised" License
10 stars 8 forks source link

Streaming upload #59

Closed remram44 closed 2 years ago

remram44 commented 2 years ago

Use streaming-form-data to write the file upload to disk as it happens rather than holding it in memory and writing it at the end.

Doing this I noticed that by default nginx holds the whole request and feeds it to the app at once. This prevents proper handling and also causes a hiccup when Tornado reads the whole request in one go. Tornado doesn't even yield, causing this warning:

WARNING asyncio: Executing <Task pending name='Task-5' coro=<HTTP1ServerConnection._server_request_loop() running at /usr/local/lib/python3.8/site-packages/tornado/http1connection.py:825> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7efe01ef7fa0>()] created at /usr/local/lib/python3.8/site-packages/tornado/http1connection.py:145> cb=[IOLoop.add_future.<locals>.<lambda>() at /usr/local/lib/python3.8/site-packages/tornado/ioloop.py:688] created at /usr/local/lib/python3.8/site-packages/tornado/gen.py:867> took 4.907 seconds