Lack of filesystem permissions to save uploaded file results in server hang
|Reported by:||Carl Meyer||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If the web server user does not have filesystem permissions to write to the "upload_to" directory of a FileField or ImageField, attempting to upload a file results in the server process hanging and eating 100% CPU.
Instead, there should be a 500 error or debug page with a sensible error message.
This issue seems to exist ever since file-storage-refactor. I can replicate it on both the Django development server and Apache 2.2 on Debian Linux.
I believe the problem is that django.core.file.storage.FileSystemStorage._save() makes unwarranted assumptions about the reason for an OSError, causing an infinite loop, as outlined by rajeshdhawan in this comment on #8203.