Hello, I have an issue where I can’t upload files bigger than ~1GB.
Nextcloud version: Nextcloud Hub 8 (29.0.0)
Operating system and version : Docker: Linux 5.15.0-105-generic x86_64
Apache or nginx version: Apache/2.4.57 (Debian)
PHP version: 8.2.13
The issue you are facing:
Can’t upload any big files via web UI.
Is this the first time you’ve seen this error? : Yes
Steps to replicate it:
- Use the provided docker compose file to create the Nextcloud instance
- Upload a file bigger than 1GB
Docker compose file:
...
nextcloud_app:
container_name: nextcloud_app
image: nextcloud
restart: always
ports:
- 8080:80
links:
- nextcloud_db
extra_hosts:
- "REDACTED:10.20.1.36"
volumes:
- nextcloud_html:/var/www/html
- /mnt/nas/REDACTED/NEXTCLOUD_DATA:/var/www/html/data
- nextcloud_apache:/etc/apache2
environment:
- MYSQL_PASSWORD=REDACTED
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=nextcloud_db
- NEXTCLOUD_DATA_DIR=/var/www/html/data
- NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.nas.REDACTED
#- REDIS_HOST=nextcloud_redis
#- REDIS_HOST_PASSWORD=REDACTED
#- REDIS_HOST_PORT=6379
- PHP_MEMORY_LIMIT=10G
- PHP_UPLOAD_LIMIT=10G
- APACHE_BODY_LIMIT=0
- APACHE_DISABLE_REWRITE_IP=1
...
As you can see I already did what was recommended regarding setting the upload limit, as well as setting the Apache setting LimitRequestBody
to 0 in the .htaccess file.
Basically the upload always fails for big files, but how that fail looks like is different:
Either after a time the upload bar is getting red and the browser / logs report 409 for the following PUTs.
Here are the logs for that scenario:
nextcloud_app | 192.168.48.1 - - [14/May/2024:16:16:24 +0000] "GET /apps/logreader/api/poll?lastReqId=hreYyVJyjrEKwKwZ6ljN HTTP/1.1" 200 793 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0"
nextcloud_app | 192.168.48.1 - - [14/May/2024:16:16:34 +0000] "GET /apps/logreader/api/poll?lastReqId=hreYyVJyjrEKwKwZ6ljN HTTP/1.1" 200 793 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0"
nextcloud_app | 192.168.48.1 - - [14/May/2024:16:16:44 +0000] "GET /apps/logreader/api/poll?lastReqId=hreYyVJyjrEKwKwZ6ljN HTTP/1.1" 200 793 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0"
nextcloud_app | 192.168.48.1 - - [14/May/2024:16:16:48 +0000] "PUT /ocs/v2.php/apps/user_status/api/v1/heartbeat?format=json HTTP/1.1" 200 965 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0"
nextcloud_app | 192.168.48.1 - - [14/May/2024:16:16:51 +0000] "DELETE /remote.php/dav/uploads/db9c028c79eebafcc3e96ac173a54c6feb2b4ef96d795dad6eb4721c9bf36159/web-file-upload-e7215fef304d2239 HTTP/1.1" 204 550 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0"
nextcloud_app | 192.168.48.1 - - [14/May/2024:16:16:51 +0000] "PUT /remote.php/dav/uploads/db9c028c79eebafcc3e96ac173a54c6feb2b4ef96d795dad6eb4721c9bf36159/web-file-upload-e7215fef304d2239/51 HTTP/1.1" 409 723 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0"
nextcloud_app | 192.168.48.1 - - [14/May/2024:16:16:51 +0000] "PUT /remote.php/dav/uploads/db9c028c79eebafcc3e96ac173a54c6feb2b4ef96d795dad6eb4721c9bf36159/web-file-upload-e7215fef304d2239/52 HTTP/1.1" 409 723 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0"
Inspecting the response of the PUT that fail in the browser I see the following response:
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\Conflict</s:exception>
<s:message/>
</d:error>
Or - and this is the most frustrating scenario: The upload is seemingly successful and then it just isn’t uploaded. No error or anything, the file will just not show up after the upload finishes.
The only error message I was able to recover in this scenario is the one from the nextcloud log stating that the deletion of the (I guess temporary-) upload file failed because there are still files in it:
{"reqId":"hreYyVJyjrEKwKwZ6ljN","level":3,"time":"2024-05-14T15:57:33+00:00","remoteAddr":"192.168.48.1","user":"db9c028c79eebafcc3e96ac173a54c6feb2b4ef96d795dad6eb4721c9bf36159","app":"PHP","method":"DELETE","url":"/remote.php/dav/uploads/db9c028c79eebafcc3e96ac173a54c6feb2b4ef96d795dad6eb4721c9bf36159/web-file-upload-fec56b7f214a44e5","message":"rmdir(/var/www/html/data/db9c028c79eebafcc3e96ac173a54c6feb2b4ef96d795dad6eb4721c9bf36159/uploads/web-file-upload-fec56b7f214a44e5): Directory not empty at /var/www/html/lib/private/Files/Storage/Local.php#157","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0","version":"28.0.1.1","data":{"app":"PHP"}}
Looking at that upload directory I could indeed confirm that there are still hundreds of 10MB files in it. So I guess that the issue is something about Nextcloud not being able to move these files from the upload directory to the target directory for some reason, tho I could confirm that the permissions seem to be correct (and small uploads work anyway so that is unlikely the problem):
root@824ea620cf85:/var/www/html# ls -la data/db9c028c79eebafcc3e96ac173a54c6feb2b4ef96d795dad6eb4721c9bf36159/files/Temp\ Share/
total 682072
drwxr-xr-x 3 www-data www-data 4096 May 14 14:35 .
drwxr-xr-x 9 www-data www-data 4096 May 4 20:41 ..
-rw-r--r-- 1 www-data www-data 13900568 May 14 13:34 '2024-04-09 v2_watermarked-2-1-1.pdf'
I would appreciate any help.