I try to upload a big file (4GB) with a PUT on a DRF viewset.
During the upload my memory is stable. At 100%, the python runserver process takes more and more RAM and is killed by the kernel. I have a logging line in the put
method of this APIView
but the process is killed before this method call.
I use this setting to force file usage FILE_UPLOAD_HANDLERS = ["django.core.files.uploadhandler.TemporaryFileUploadHandler"]
Where does this memory peak comes from? I guess it try to load the file content in memory but why (and where)?
More information:
- I tried DEBUG true and false
- The runserver is in a docker behind a traefik but there is no limitation in traefik AFAIK and the upload reaches 100%
- I do not know yet if I would get the same behavior with
daphne
instead of runserver - EDIT: front use a
Content-Type multipart/form-data
- EDIT: I have tried
FileUploadParser
and(FormParser, MultiPartParser)
for parser_classes in myAPIView