Timeout when uploading large file from client to server

Hello everyone,

maybe I’ve found a bug in the NC Desktop client for Windows. My NC instance is set up to sync large files and works perfect if I upload the file used below through the web interface. Synchronization with the desktop client doesn’t work:

  1. File (22GB) is added to NC directory.
  2. The file is transferred to the server completely.
  3. Progress stops at “0s remaining”, server side CPU load drops to ~20% and harddisk I/O raises.
  4. Instead of waiting for the server to finish processing the file, the client throws a timeout error after a few minutes.
  5. After about 20mins the file appears properly on the server and other clients can download it. The failing client has to be restartet and recognizes the file as synced.
  6. There are no errors in the server logs (Apache and NC).

A few details about my configuration:

  • Nextcloud 11.0.2 hostet within a virtual machine on a XenServer 7: 4GB RAM and 4 CPU-Cores for the VM, physical CPU is a Celeron J1900.
  • Debian Jessie, set up today with Apache 2.4.10, PHP 7 and MariaDB 10.0.30.
  • Self signed SSL-certificates
  • Client 2.2.4 on Windows 8.1 and Windows 10, both have this problem.
  • PHP timeout parameters set to 2h like mentioned in the documentation, no other restricting parameters were found in my Apache- and SSL-config
  • Maximum file size in PHP and NC set to 200GB
  • Clients and server connected with gigabit ethernet

This is reproduceable. What I can see is that the server is doing fine as the file appears ok after the server has processed it for about 20mins. Now I can restart the client and it recognizes the file correctly as synced. Other clients download the file as well. I don’t know what the server does after the upload, but I guess that it merges the splitted file and/or calculates a checksum because there is a heavy disk I/O on the server. The timeout detection at the client side should take account of this to support large files on slow servers like mine.

Additionally, the transfer with the client takes four times longer than with the web interface, but that is ok for me. Does anybody have a hint for me how to fix the timeouts or is it actually a bug? Is the client-side timeout adjustable? Please forgive me if this is caused by a faulty configuration :slight_smile:

Arne

Looks like the client doesn’t wait long enough. But copying should be faster than 20 min on a local disk (for 20 minutes, the transfer rate is less than 19 MB/s).

For the upload via client: Files are normally split up in chunks of 5 MB and chunks can be uploaded parallel. This increases the upload speed on normal internet connections, for gigabit networks the chunksize is too small. You can manually set a environment variable to increase it:
https://doc.owncloud.org/desktop/2.3/advancedusage.html#configuration-file

Hi,
It’s interesting the issue you have with large files.
I find myself in the same situation with much smaller files.

I am using:

Nextcloud “version”: “11.0.2.7”,
PHP 7.0.15-0ubuntu0.16.04.4 (fpm-fcgi)
nginx version: nginx/1.10.0 (Ubuntu)
HA-Proxy version 1.6.3 2015/12/25
mariadb-server-10.1

I have set most of the settings i can find to high values:

config.php
‘dbdriveroptions’ => array(
PDO::MYSQL_ATTR_INIT_COMMAND => ‘SET wait_timeout = 28800’
),
‘dbdriveroptions’ =>
array (
1002 => ‘SET wait_timeout = 28800’,
),

php.ini
max_execution_time = 3600
max_input_time = -1
memory_limit = 512M
post_max_size = 16G
upload_tmp_dir = /nextcloudtmp/
upload_max_filesize = 16G
max_file_uploads = 20

php www.conf
request_terminate_timeout = 3600s

nginx config:
client_max_body_size 16G;
fastcgi_buffers 64 4K;
gzip off;
fastcgi_request_buffering off;
location ~^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34]).php(?:$|/) {
include fastcgi_params;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
fastcgi_read_timeout 300;
}

Here are the kinds of errors i am getting:

“reqId”:“5PP2OU4szySCBQs/Rb4f”,“remoteAddr”:“96.20.23.217”,“app”:“webdav”,“message”:“Exception: {"Message":"HTTP\/1.1 500 An exception occurred while executing ‘SELECT fileid, storage, path, parent, name, mimetype, mimepart, size, mtime,\n\t\t\t\t\t storage_mtime, encrypted, etag, permissions, checksum\n\t\t\t\tFROM oc_filecache WHERE storage = ? AND path_hash = ?’ with params [30, \"2e45cb7e4749322bfdc16d746dec882f\"]:\n\nSQLSTATE[HY000]: General error: 2006 MySQL server has gone away","Exception":"Sabre\\DAV\\Exception","Code":0,"Trace":"#0 \/var\/www\/nextcloud\/apps\/dav\/lib\/Connector\/Sabre\/File.php(106): OCA\\DAV\\Connector\\Sabre\\File->convertToSabreException(Object(Doctrine\\DBAL\\Exception\\DriverException))\n#1 \/var\/www\/nextcloud\/apps\/dav\/lib\/Connector\/Sabre\/Directory.php(137): OCA\\DAV\\Connector\\Sabre\\File->put(Resource id #17)\n#2 \/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(1072): OCA\\DAV\\Connector\\Sabre\\Directory->createFile(‘LibreOffice_5.2
’, Resource id #17)\n#3 \/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php(525): Sabre\\DAV\\Server->createFile(‘Apps\/LibreOffic
’, Resource id #17, NULL)\n#4 [internal function]: Sabre\\DAV\\CorePlugin->httpPut(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#5 \/var\/www\/nextcloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n#6 \/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(479): Sabre\\Event\\EventEmitter->emit(‘method:PUT’, Array)\n#7 \/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(254): Sabre\\DAV\\Server->invokeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#8 \/var\/www\/nextcloud\/apps\/dav\/appinfo\/v1\/webdav.php(60): Sabre\\DAV\\Server->exec()\n#9 \/var\/www\/nextcloud\/remote.php(165): require_once(‘\/var\/www\/nextcl
’)\n#10 {main}","File":"\/var\/www\/nextcloud\/apps\/dav\/lib\/Connector\/Sabre\/File.php","Line":557,"User":"524400001"}”,“level”:4,“time”:**“2017-03-20T20:25:57+00:00”,“method”:“PUT”,“url”:“/remote.php/webdav/Apps/LibreOffice_5.2.4_Win_x86.msi-chunking-959466703-11-**4”,“user”:“524400001”,“version”:“11.0.2.7”}

Would someone have inspiration as to where to look?
Thanks
D

Thank you, I will try this in the next few days.