Problem uploading files to NC18 - Expected filesize of 1024000 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 696024 bytes

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version 18.0.0:
Operating system and version Ubuntu 18.04.3:
Apache or nginx version nginx/1.17.5:
PHP version 7.3.14:
Mobile phone Nokia 8.1:
Android version 10:

The issue you are facing:

File upload to Nextcloud fails from mobile device or web portal.

Is this the first time you’ve seen this error? Y:

Steps to replicate it:

  1. Try to upload a file to Nextcloud.
  2. Upload seems to begin, percentage rises but very slowly, and eventually fails with “Connection error”.

The issue is with a cloud based (SSDNODES) server I’ve just built using this guide: https://blog.ssdnodes.com/blog/self-hosting-handbook/.Nextcloud, database, and nginx are all running in docker containers.

I have another Nextcloud cloud based (AWS) server running version 16, which I do not have the same issue with. This server doesn’t use docker or reverse proxies.

I’ve noticed these things:

  1. Uploads fail on wifi or cellular.
  2. Uploads are successful if my VPN is turned on.

I’ve had a look around and have seen similar issues with people using Cloudflare to manage their DNS, which is solved by disabling Browser Integrity Check. I am using Cloudflare, and disbling BIC doesn’t help my issue.

Any help would be great!

The output of your Nextcloud log in Admin > Logging:

[no app in context] Error: Sabre\DAV\Exception\BadRequest: Expected filesize of 1024000 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 696024 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side. at <<closure>>

 0. /var/www/html/apps/dav/lib/Connector/Sabre/Directory.php line 156
    OCA\DAV\Connector\Sabre\File->put(null)
 1. /var/www/html/apps/dav/lib/Upload/UploadFolder.php line 47
    OCA\DAV\Connector\Sabre\Directory->createFile("0000000002048000-0000000003071999", null)
 2. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 1096
    OCA\DAV\Upload\UploadFolder->createFile("0000000002048000-0000000003071999", null)
 3. /var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
    Sabre\DAV\Server->createFile("uploads/myuser/b0b ... 9", null, null)
 4. <<closure>>
    Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 5. /var/www/html/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([Sabre\DAV\CorePlugin {},"httpPut"], [Sabre\HTTP\Requ ... }])
 6. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    Sabre\Event\EventEmitter->emit("method:PUT", [Sabre\HTTP\Requ ... }])
 7. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 8. /var/www/html/apps/dav/lib/Server.php line 319
    Sabre\DAV\Server->exec()
 9. /var/www/html/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
10. /var/www/html/remote.php line 165
    require_once("/var/www/html/a ... p")

PUT /remote.php/dav/uploads/myuser/b0baa8183339d2466fa6ec782089fcc8/0000000002048000-0000000003071999
from X.X.X.X by myuser at 2020-02-01T06:17:49+00:00

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'XXX',
  'passwordsalt' => 'XXX',
  'secret' => 'XXX',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.my.domain',
  ),
  'trusted_proxies' => 
  array (
    0 => 'X.X.X.X',
    1 => 'X.X.X.X',
  ),
  'overwrite.cli.url' => 'https://nextcloud.my.domain',
  'overwriteprotocol' => 'https',
  'overwritehost' => 'nextcloud.my.domain',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '18.0.0.10',
  'overwrite.cli.url' => 'http://nextcloud.my.domain',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'XXX',
  'dbpassword' => 'XXX',
  'installed' => true,
  'maintenance' => false,
);

1 Like

Bump for visibility… Any thoughts anyone?

I’ve seen some similar issues with fixes around Apache timeouts, but I’ve not been successful with any of those fixes.

Really would like to get this sorted, if anyone can help with a starting point at least?

So, 3 days and no replies…

Is there another help channel I can go through? Or is this the only place?

Cheers

Hey, I’m back again. Still no luck on my end. Any help would be great!

Anyone able to help yet? I’m beginning to think that NC18 isn’t worth the trouble at this stage…

There was a post on the old owncloud forum, summing up possible points to check. In general, these were some timeouts (either between webserver and php, php and database, …). And if you use reverse proxies, there is even more fun.

If it works over VPN, you have a good indicator that it must happen at a step that the VPN skips (reverse webserver?).

Thanks for your response. I tried a bunch of those points already, with no success.

I have solved the issue by using the NC17 docker image instead of NC18, with no additional edits to the config files necessary.

I have some times these errors too. On the same second 2 errors with the same picture. Errors are only slightly different.

{"reqId":"DjdcpNx7gITOr1pzd1WI","level":3,"time":"2020-02-11T14:18:59+00:00","remoteAddr":"1.111.222.111","user":"user","app":"no app in context","method":"PUT","url":"/remote.php/webdav/Photos/2020.02.11.15.30-7556.jpg","message":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"Expected filesize of 2996497 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 1064960 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","Code":0,"Trace":[{"file":"/home/nginx/web/domain.name/public/apps/dav/lib/Connector/Sabre/Directory.php","line":156,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/home/nginx/web/domain.name/public/3rdparty/sabre/dav/lib/DAV/Server.php","line":1096,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/home/nginx/web/domain.name/public/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":525,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->"},{"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/home/nginx/web/domain.name/public/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array"},{"file":"/home/nginx/web/domain.name/public/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->"},{"file":"/home/nginx/web/domain.name/public/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/home/nginx/web/domain.name/public/apps/dav/appinfo/v1/webdav.php","line":82,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/home/nginx/web/domain.name/public/remote.php","line":165,"args":["/home/nginx/web/domain.name/public/apps/dav/appinfo/v1/webdav.php"],"function":"require_once"}],"File":"/home/nginx/web/domain.name/public/apps/dav/lib/Connector/Sabre/File.php","Line":229,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (iOS) Nextcloud-iOS/2.25.6","version":"18.0.1.1"}
{"reqId":"DjdcpNx7gITOr1pzd1WI","level":4,"time":"2020-02-11T14:18:59+00:00","remoteAddr":"1.111.222.111","user":"user","app":"webdav","method":"PUT","url":"/remote.php/webdav/Photos/2020.02.11.15.30-7556.jpg","message":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"Expected filesize of 2996497 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 1064960 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","Code":0,"Trace":[{"file":"/home/nginx/web/domain.name/public/apps/dav/lib/Connector/Sabre/Directory.php","line":156,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/home/nginx/web/domain.name/public/3rdparty/sabre/dav/lib/DAV/Server.php","line":1096,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/home/nginx/web/domain.name/public/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":525,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->"},{"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/home/nginx/web/domain.name/public/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array"},{"file":"/home/nginx/web/domain.name/public/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->"},{"file":"/home/nginx/web/domain.name/public/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/home/nginx/web/domain.name/public/apps/dav/appinfo/v1/webdav.php","line":82,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/home/nginx/web/domain.name/public/remote.php","line":165,"args":["/home/nginx/web/domain.name/public/apps/dav/appinfo/v1/webdav.php"],"function":"require_once"}],"File":"/home/nginx/web/domain.name/public/apps/dav/lib/Connector/Sabre/File.php","Line":229,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (iOS) Nextcloud-iOS/2.25.6","version":"18.0.1.1"}
access.log :1.111.222.111 - user [11/Feb/2020:16:18:59 +0200] "PUT /remote.php/webdav/Photos/2020.02.11.15.30-7556.jpg HTTP/2.0" 400 0 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/2.25.6"
access.log :1.111.222.111 - user [11/Feb/2020:16:23:24 +0200] "PUT /remote.php/webdav/Photos/2020.02.11.15.30-7556.jpg HTTP/2.0" 201 0 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/2.25.6"

Nginx log shows that first try to upload gave 400 error and errors in nextcloud log are because off that. Propably…
About 4 and half minutes later upload was successfull from the same network.

My server
Nextcloud version 18.0.1 RC2
Operating system and version Centos 7.7
Apache or nginx version nginx/1.17.8
PHP version 7.4.2
Database 10.4.12-MariaDB MariaDB Server
Redis cache

These errors happens with iOSapp. I have seen these earlier with NC 18.0. But I don’t think that I have had this with NC 17. Pretty similar setup with nc17.

More help is welcome. It would be nice to solve this.

I am also seeing these problems since my upgrade to NC18. I am using FreeBSD, Nginx, php-fpm and have ha-proxy in front of the installation. Now one might assume that this bears potential for numerous timeout/config-problems.

However: I have not had these problems before. AND:

  • Upload of single files via the web client usually works. The problem starts when I choose 5-10 files and upload these en bloc. Some work, some don’t.
  • If I drag them to a folder and have nextcloud Mac client synchronize: Thins work like a charm without a single problem.

This looks more like a web client issue to me that started with NC18. Any ideas?

Hello,

I have the same problem. I use NC18 with External Storage wich ist trought Webdav connected. If I try copy more files then is failed.

Sabre\DAV\Exception\BadRequest: Expected filesize of 10485760 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 2392064 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.

Hi all,

I think I have the same issue and also think this is connected to the fact, that I migrated the storage from local virtio drive to networkstorage mounted under the same path as NFS.

I also upgraded to NC 17.0.5 before I noticed my issue with the automatic picture upload via WIFI.

Edit: PHP: 7.3, Apache2, Debian 10

I think those links/issues might be related:

Kind regards,
F4B1

I had the trouble only with ha-proxy in front of nginx/nextcloud. Turns out: If I disable http2 on nginx and haproxy: All is well!

@j.koopmann I have a similar configuration to you (freebsd/nginx/haproxy), but I’m running NC19 and seeing the same problem.

It seems there are numerous other posts reporting the same problem.

After trying various tuning recommendations, including https://autoize.com/nextcloud-performance-troubleshooting/, I followed your recommendation and disabled http2 in both nginx and in the haproxy backend for nextcloud.

That did NOT resolve the issue. I still see those errors in the log.

It would seem that a bug should be reported to the NC team so they can determine the root cause.