nextcloud / desktop

💻 Desktop sync client for Nextcloud
https://nextcloud.com/install/#install-clients
GNU General Public License v2.0
2.97k stars 784 forks source link

Interrupted sync downloads do not resume but restart at 0kb #2963

Open PetrusVermaak opened 3 years ago

PetrusVermaak commented 3 years ago

I have a very bad internet connection that is intermittent, and nothing I can do about it due to location. When nextcloud downloads a large file from the server to my windows through syncing via the desktop app, if the download is interrupted, it restarts the temp .~ file instead of resuming where it left off. How can I setup/specify chunk download size or how can I configure nextcloud to resume instead?

Log Files

Nothing in nextcloud desktop log, and nothing on nextcloud server log.

Windows Desktop Sync Client Error:

Connection Closed

Expected behaviour

Nextcloud desktop sync must continue interrupted temp .~ download files, not restart.

Actual behaviour

The .~ temp file is re-downloaded starting from 0kb

Steps to reproduce

  1. Download a large file, interrupt the internet connection and see if the file resumes or restarts from the beginning.

Operating system: Windows

Nextcloud Server Version: 20.0.7 Nextcloud Desktop Version: 3.1.3

FlexW commented 3 years ago

That would be a nice feature to have but is probably not that straight forward to implement.

PetrusVermaak commented 3 years ago

Would be much needed and appreciated. Nextcloud should chunk and resume both ways, up and down.

Alvarord commented 3 years ago

I have faced a similar problem in a network and I received this kind of error when the connection is unstable:

error:1408F119:SSL routines:ssl3_get_record:decryption - Maybe related with TLS1.3 that the server is providing.

It takes ages to recover for the client, as it receives a SyncFileItem::FatalError and it never recovered, I tried to modify the errror as Soft ( SyncFileItem::SoftError ) and that improved a little the client but with big files that fails a lot finally I didn't manage to make it work so the client only works now through a proxy close the server (seems the connection is MUCH more stable with the proxy than directly with the server, not a very clean patch but it works).

I have tried to patch the client without too much success but I think this resume could be nice, for example to try partial downloads in case of connections error.

Is anybody working on it?

FlexW commented 3 years ago

Is anybody working on it?

No

Alvarord commented 3 years ago

Finally the network issue was really painful so I needed to patch the client.

Is just a patch to retry the download faster in case the SSL issue arises, is not very clean so I just paste it in case anybody has the same issue.

diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp
index dcc5dc7d6..ca57b1abf 100644
--- a/src/libsync/owncloudpropagator.cpp
+++ b/src/libsync/owncloudpropagator.cpp
@@ -279,7 +279,7 @@ void PropagateItemJob::done(SyncFileItem::Status statusArg, const QString &error
     emit propagator()->itemCompleted(_item);
     emit finished(_item->_status);

-    if (_item->_status == SyncFileItem::FatalError) {
+    if (_item->_status == SyncFileItem::FatalError && ! errorString.contains("1408F119:SSL") ) { // This error is shown when the SSL connection timeout in the middle of the download. Not a very clean patch
         // Abort all remaining jobs.
         propagator()->abort();
     }