I keep getting upload errors when auto uploading photos to my self-hosted nextcloud instance via Android auto upload. Often the upload will fail, sometimes goes through after the xth restart but in general will be very slow. I saw the error is well known here on this board and users tried to get ahold of it by changing apache configs for chunk_size and mod_reqtimeout for very large files. However, I am not running apache and the file size is in the region of 2-4MB, so not really large.
Android app is up to date (v 3.30.6), just like nextcloud (30.0.4). Nextcloud is running in docker with mariadb (10.11), redis and caddy (recent).
Error message at the android client is not helpful but just saying the upload failed.
Nextcloud log:
BadRequest
Expected filesize of 2485459 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 1867776 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.
It seems like you’re experiencing upload issues with Nextcloud due to either network instability or server-side storage issues. Here are some suggestions:
Check Network Stability: Ensure your mobile connection or Wi-Fi is stable. Consider testing uploads on a different network.
File Permissions: Verify that the server’s storage has proper write permissions and enough free space.
Server Logs: Look for specific errors in the Nextcloud or Docker logs to identify potential issues with storage or network.
Docker Settings: Since you’re using Docker, check the container’s resource limits (e.g., memory, CPU) to ensure they aren’t too restrictive.
Increase Upload Limits: Even though the file isn’t large, try adjusting your Docker or Nextcloud configuration for upload limits (e.g., max_upload_size).
If the issue persists, try testing with smaller files to see if size is still a factor or if it’s network related.
Thank you for your suggestions. I tested my setup more thoroughly. The logs do not have much and only show the start of transfer. There is nothing on why they will not get through, not even a timeout.
However, I believe I was able to trace the issue back to restrictions in docker-compose, namely the following block:
I tried several combinations of those restrictions in place and commented out with uploads of different sizes. Generally the issues seem to start with files around 3-4MB when the PHP_OPCACHE_MEMORY_CONSUMPTION is set. It seems like the value does not matter much, both with 128 as well as 512, uploads are failing.
I don’t understand why this line causes the issues though. Could it be that the root cause is somewhere else but limiting memory for php scripts triggers it?
max_upload_size is at 512MB
(chunking at 5MB, by the way).
I tested some more, but still the issue seems to be linked to PHP_OPCACHE_MEMORY_CONSUMPTION. When I comment it out, all is working fine. With it and no matter the value, uploads fail.