Chunks on server do not sum up - DAV - Raspberry pi

Steps to reproduce

  1. Create or change a file in the local directory
  2. Wait for next synchronization by desktop client

Expected behaviour

File should be created / updated in the server

Actual behaviour

Randomly, the file upload fails with the error : “Chunks on server do not sum up to but to <another, smaller size, not always the same>”
It happens with the desktop client only, not the web interface.
It happens with large file (at least 30 MB) but not VERY large files, like in other issues, when the problem was due to an integer overflow for 32 bits systems.
We are way below the 2 GB limit, here.

Server configuration

Operating system:
OSMC 2020-10-1, which means Raspbian 10 - Buster
Web server:
Apache 2.4.38
Database:
MariaDB 10.3.23
PHP version:
7.3.23
ownCloud version: (see ownCloud admin page)
10.5.0
Updated from an older ownCloud or fresh install:
10.3.2 was a fresh install.
Updated from it to 10.5.0 through the web admin interface.
The previous version had the problem as well.
Where did you install ownCloud from:
With a tar.gz from the OSMC repository
Signing status (ownCloud 9.0 and above):

No errors have been found.

The content of config/config.php:
Nothing sensitive here: the server is strictly used in a local network. It does not answer from outside.
It is used to centralize music in the raspberry pi and redistribute it to the various home music readers.

https://pastebin.com/aVCGBnxV

List of activated apps:

Enabled:
  - comments: 0.3.0
  - configreport: 0.2.0
  - dav: 0.6.0
  - federatedfilesharing: 0.5.0
  - federation: 0.1.0
  - files: 1.5.2
  - files_external: 0.7.1
  - files_mediaviewer: 1.0.3
  - files_sharing: 0.13.0
  - files_trashbin: 0.9.1
  - files_versions: 1.3.0
  - firstrunwizard: 1.2.0
  - market: 0.6.0
  - notifications: 0.5.2
  - provisioning_api: 0.5.0
  - systemtags: 0.3.0
  - updatenotification: 0.2.1
Disabled:
  - encryption
  - external
  - user_external

Are you using external storage, if yes which one: local/smb/sftp/…
No.
Are you using encryption: yes/no
No
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/…
No

Client configuration

Browser:
Firefox 82.0 (64 bits)
Operating system:
Ubuntu 20.04
Desktop client:
2.6.3 (build 2668) installed through apt.

Logs

Web server error log

192.168.0.51 - musica [27/Oct/2020:17:30:59 +0100] "PROPFIND /owncloud/remote.php/dav/files/musica/ HTTP/1.1" 207 953 "-" "Mozilla/5.0 (Linux) mirall/2.6.3 (build 2668)"
192.168.0.51 - musica [27/Oct/2020:17:30:59 +0100] "PROPFIND /owncloud/remote.php/dav/files/musica/ HTTP/1.1" 207 203982 "-" "Mozilla/5.0 (Linux) mirall/2.6.3 (build 2668)"
192.168.0.51 - - [27/Oct/2020:17:31:00 +0100] "GET /owncloud/ocs/v2.php/apps/notifications/api/v1/notifications?format=json HTTP/1.1" 200 863 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv
:82.0) Gecko/20100101 Firefox/82.0"
192.168.0.51 - musica [27/Oct/2020:17:31:00 +0100] "PROPFIND /owncloud/remote.php/dav/files/musica/TeamRKT HTTP/1.1" 207 2513 "-" "Mozilla/5.0 (Linux) mirall/2.6.3 (build 2668)"
192.168.0.51 - musica [27/Oct/2020:17:31:00 +0100] "PROPFIND /owncloud/remote.php/dav/files/musica/TeamRKT/Cities HTTP/1.1" 207 3749 "-" "Mozilla/5.0 (Linux) mirall/2.6.3 (build 2668)"
192.168.0.51 - musica [27/Oct/2020:17:31:01 +0100] "MKCOL /owncloud/remote.php/dav/uploads/musica/1990409589 HTTP/1.1" 201 547 "-" "Mozilla/5.0 (Linux) mirall/2.6.3 (build 2668)"
192.168.0.51 - musica [27/Oct/2020:17:31:03 +0100] "PUT /owncloud/remote.php/dav/uploads/musica/1990409589/0000000000000000 HTTP/1.1" 201 580 "-" "Mozilla/5.0 (Linux) mirall/2.6.3 (build 26
68)"
192.168.0.51 - musica [27/Oct/2020:17:31:04 +0100] "PUT /owncloud/remote.php/dav/uploads/musica/1990409589/0000000010000000 HTTP/1.1" 201 580 "-" "Mozilla/5.0 (Linux) mirall/2.6.3 (build 26
68)"
192.168.0.51 - musica [27/Oct/2020:17:31:09 +0100] "MOVE /owncloud/remote.php/dav/uploads/musica/1990409589/.file HTTP/1.1" 400 775 "-" "Mozilla/5.0 (Linux) mirall/2.6.3 (build 2668)"

ownCloud log (data/owncloud.log)

{"reqId":"70e22cc1-7ec4-4842-b2bf-6a5218f459d8","level":4,"time":"2020-10-27T16:29:46+00:00","remoteAddr":"192.168.0.51","user":"musica","app":"webdav","method":"MOVE","url":"\/owncloud\/re
mote.php\/dav\/uploads\/musica\/1399293648\/.file","message":"Exception: HTTP\/1.1 400 Chunks on server do not sum up to 47875022 but to 20485760: {\"Exception\":\"Sabre\\\\DAV\\\\Exception
\\\\BadRequest\",\"Message\":\"Chunks on server do not sum up to 47875022 but to 20485760\",\"Code\":0,\"Trace\":\"#0 \\\/usr\\\/share\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Upload\\\/Chunkin
gPlugin.php(57): OCA\\\\DAV\\\\Upload\\\\ChunkingPlugin->verifySize()\\n#1 \\\/usr\\\/share\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/WildcardEmitterTrait.php(89): OCA\\\\D
AV\\\\Upload\\\\ChunkingPlugin->beforeMove('uploads\\\/musica\\\/...', 'files\\\/musica\\\/Te...')\\n#2 \\\/usr\\\/share\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Core
Plugin.php(603): Sabre\\\\DAV\\\\Server->emit('beforeMove', Array)\\n#3 \\\/usr\\\/share\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/WildcardEmitterTrait.php(89): Sabre\\\\DA
V\\\\CorePlugin->httpMove(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/usr\\\/share\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.p
hp(470): Sabre\\\\DAV\\\\Server->emit('method:MOVE', Array)\\n#5 \\\/usr\\\/share\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(251): Sabre\\\\DAV\\\\Server->in
vokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#6 \\\/usr\\\/share\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Server.php(329): Sabre\\\\DAV\\\\Server->start()\\
n#7 \\\/usr\\\/share\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#8 \\\/usr\\\/share\\\/owncloud\\\/remote.php(165): require_once('\\\/usr\
\\/share\\\/ownc...')\\n#9 {main}\",\"File\":\"\\\/usr\\\/share\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Upload\\\/ChunkingPlugin.php\",\"Line\":103}"}

Browser log

Nothing special. Most of the time, it works throught the web interface, the problems seems to arise for the desktop client only.

Do you have enough free space in your temporary directory?

It’s possible that the web server can’t write the whole file there, or maybe some chunks, and when ownCloud assembles the file it notices that the part of the file is missing.
It might be possible that the desktop client sends the file in several chunks and the last ones are missing.

1 Like

@jvillafanez, you certainly found the point!
I’m using a RAM tmp directory which is ridiculously small.
I’ll increase its size and check back to you.

Thanks a lot!

Sorry, not in RAM, in tmpfs.

Yep!
It works like a charm.

I can’t believe I undermined my own server with this cheap optimization…

Thanks a lot!

2 Likes