Problem when uploading large files
The lighttpd webserver has a nice feature making it possible to specify several upload directories. If one directory is full the next directory will be taken. But there is a small implementation issue that has to be fixed to make this feature fully operational. If you look at the implementation in chunkqueue_get_append_tempfile (chunk.c) you will see that the check is only done at file creation time (calling of mkstemp), but what would happen if the file can be created but it is not enough storage available (e.g. 2 bytes left on that storage directory) to write the chunk ? .... an 413 error will occur. For the user this behavior is not understandable. Imagine that you work on an embedded system (like in our project) where the ram disk is very fast (100 MB/sec) but the persistent storage is very slow (1 MB/s) then you would love to use this feature. First write the data to the very fast ram disk, if the storage is full use the next storage directory (and so on). But there has to be done a small fix. I would propose to ensure that the storage space is really available by calling the allocate-function (posix_allocate on posix systems / fallocate on linux system), see the patch attached
[core] retry tempdirs on partial write, ENOSPC (fixes #2588)
Previous code would fail on partial write, EINTR, and ENOSPC.
Upon any of the above errors, this patch tries next tempdir in list,
if list of tempdirs provided by config option server.upload-dirs
"Problem when uploading large files"
Also available in: Atom