Replies: 4 comments 1 reply
-
If I recall correctly, starlette sets up the UploadFile to spool the temp file to disk at the 1MB mark. So I think that probably explains why 1MB is a threshold for this behavior. I don't currently have more insight than that, but it might be worth trying to make the calls using the starlette TestClient in a debugger and see if you can reproduce the behavior, and figure out what is taking so long and/or blocking. Ideally stepping through. |
Beta Was this translation helpful? Give feedback.
-
worth testing if you end up with same behaviour with swagger-ui too
…On Fri, Nov 8, 2019 at 8:15 AM dmontagu ***@***.***> wrote:
If I recall correctly, starlette sets up the UploadFile to spool the temp
file to disk at the 1MB mark. So I think that probably explains why 1MB is
a threshold for this behavior.
I don't currently have more insight than that, but it might be worth
trying to make the calls using the starlette TestClient in a debugger and
see if you can reproduce the behavior.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#693?email_source=notifications&email_token=AAINSPSWQDLB57KPOPZZRALQSUGYDA5CNFSM4JKTPQ52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDO6SUA#issuecomment-551414096>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAINSPUFZNVFELQMUEZUF4LQSUGYDANCNFSM4JKTPQ5Q>
.
--
benoit barthelet
http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE
|
Beta Was this translation helpful? Give feedback.
-
Thanks @dmontagu and @euri10 for the help! 🙇♂️ @chongeva I wasn't able to reproduce the issue. Maybe it was from a previous version? Here's a simplified, self-contained example, from your own code: from typing import List
from fastapi import FastAPI, UploadFile, File
app = FastAPI()
@app.post("/uploadfiles/")
async def create_upload_files(files: List[UploadFile] = File(...)):
return {"filenames": [file.filename for file in files]} Then calling it with curl: $ curl -F 'files=@t1.zip' -F 'files=@t2.zip' -F 'files=@t3.zip' -F 'files=@t4.zip' http://localhost:8000/uploadfiles/
{"filenames":["t1.zip","t2.zip","t3.zip","t4.zip"]} And each one of the files Have in mind that Swagger UI won't display a correct widget for lists of files. That's an issue in Swagger UI itself. |
Beta Was this translation helpful? Give feedback.
-
Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues. |
Beta Was this translation helpful? Give feedback.
-
I've been trying to get the file upload to work but it keeps getting stuck, or hang.
I have python-multipart installed. Using fastapi 0.42.0
Using POSTMAN to test the API call. I've tried attaching single file, and multiple files. If the file sizes are close to or more than 1mb, the process will hang.
I've searched online and couldn't find any similar issues, and I'm not sure why this happened. I've tried uploading small files, like 10kb files, and they work fine. I tested this in my local machine, and also in another server with NGINX, with client_max_body_size set to 100mb. Same problem.
May I know what else should I do, or check, to allow bigger file sizes to be uploaded?
Beta Was this translation helpful? Give feedback.
All reactions