You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the network switches from WiFi to mobile while syncing, the syncing process will stop and needs to be manually started again to continue. This is not appreciated; it should resume automatically.
Steps to reproduce
Start syncing.
Switch networks.
Realize it has stopped.
Expected behavior
If the network I switched to is set/allowed to sync, it should resume automatically.
Actual behavior
It stops and needs to be resumed manually.
Details
$ /usr/bin/ocis versionVersion: 5.1.0-prealpha+52b00b116Compiled: 2024-04-10 00:00:00 +0000 UTC
Thanks for reporting, will take a look inside. Connection is detected as lost in the middle of network switching and not resumed. In fact, connections are only resumed in case of connection recovery after outage.
We have an operating system restriction that causes the worker to be relaunched when it meets the requirements it has. In our case, it has a restriction to only execute if there is an internet connection. When we switch connections (from Wi-Fi to cellular), the operating system decides if there is a violation of the worker’s rules, as it might interpret this specific situation as a loss of connection rather than a network change. In any case, it is something beyond our control as it depends on the operating system.
As a potential solution, we could include a manual retry in the worker’s catch block that only works when there is an active network and a NetworkErrorException has occurred. This way, when a network change occurs, the upload would be retried.
However, this would not completely solve the problem, as this condition might not be met for the following reason:
There is a network change, but the process was not fast enough for the network validation function to detect that a network is available. Therefore, it will detect that there is no connection. This issue is arbitrary because it depends on the speed at which the device connects to the network.
This possible solution would only work for workers: uploads and downloads. All other synchronization operations must be handled separately.
On the other hand, we have a problem with the download worker. When we lose the connection, we receive a NoNetworkConnectionException() error when we should receive a NetworkErrorException(). As a result, in this case, we cannot differentiate a priori whether the cause of the error was a server failure or a loss of connection.
Still reproducible on current master. The transfer workers have no network-switch resume path:
UploadFileFromFileSystemWorker.kt:121-125 — catch (throwable) { ... Result.failure() }. Any throwable (incl. a connectivity drop during a WiFi↔mobile switch) returns failure, never retry, so WorkManager won't re-run the upload on network recovery.
DownloadFileWorker.kt:282-285 — only NoConnectionWithServerException maps to Result.retry(); every other throwable → Result.failure(). A network-switch error not of that exact type stops without retry.
This matches @Aitorbp's Sept-2024 analysis: returning Result.retry() for connectivity-class exceptions (when a network is/again available) would let WorkManager resume on the network change, but the worker can't reliably distinguish "connection lost" from "server error" — download surfaces NoNetworkConnectionException where NetworkErrorException is expected. The exception-classification gap is the prerequisite fix; the retry mapping depends on it.
Activity
micbar commentedon Apr 11, 2024
@TheOneRing @dragotin
can you help to gather the needed info? What could trigger that?
TheOneRing commentedon Apr 12, 2024
@the-hotmann which client are you using?
the-hotmann commentedon Apr 12, 2024
@micbar @TheOneRing thanks for the swift response!
I use the android client from the PlayStore in the latest version
4.2.1 (a41d1f917)jesmrec commentedon Apr 12, 2024
Thanks for reporting, will take a look inside. Connection is detected as lost in the middle of network switching and not resumed. In fact, connections are only resumed in case of connection recovery after outage.
the-hotmann commentedon Apr 13, 2024
@jesmrec you're welcome!
Can you please leep this thread up-to-date and inform us about your findings and eventual changes?
Thanks in advance!
jesmrec commentedon Apr 15, 2024
Sure. At this point, we'll need to check how deep the changes would be... but it deserves a look.
Aitorbp commentedon Sep 4, 2024
We have an operating system restriction that causes the worker to be relaunched when it meets the requirements it has. In our case, it has a restriction to only execute if there is an internet connection. When we switch connections (from Wi-Fi to cellular), the operating system decides if there is a violation of the worker’s rules, as it might interpret this specific situation as a loss of connection rather than a network change. In any case, it is something beyond our control as it depends on the operating system.
As a potential solution, we could include a manual retry in the worker’s catch block that only works when there is
an active networkand aNetworkErrorExceptionhas occurred. This way, when a network change occurs, the upload would be retried.However, this would not completely solve the problem, as this condition might not be met for the following reason:
This possible solution would only work for workers: uploads and downloads. All other synchronization operations must be handled separately.
On the other hand, we have a problem with the download worker. When we lose the connection, we receive a
NoNetworkConnectionException()error when we should receive aNetworkErrorException(). As a result, in this case, we cannot differentiate a priori whether the cause of the error was a server failure or a loss of connection.[-]Sync stops after Network switch[/-][+][BUG] Sync stops after Network switch[/+]DeepDiver1975 commentedon Jun 30, 2026
Still reproducible on current
master. The transfer workers have no network-switch resume path:UploadFileFromFileSystemWorker.kt:121-125—catch (throwable) { ... Result.failure() }. Any throwable (incl. a connectivity drop during a WiFi↔mobile switch) returnsfailure, neverretry, so WorkManager won't re-run the upload on network recovery.DownloadFileWorker.kt:282-285— onlyNoConnectionWithServerExceptionmaps toResult.retry(); every other throwable →Result.failure(). A network-switch error not of that exact type stops without retry.This matches @Aitorbp's Sept-2024 analysis: returning
Result.retry()for connectivity-class exceptions (when a network is/again available) would let WorkManager resume on the network change, but the worker can't reliably distinguish "connection lost" from "server error" — download surfacesNoNetworkConnectionExceptionwhereNetworkErrorExceptionis expected. The exception-classification gap is the prerequisite fix; the retry mapping depends on it.🤖 Generated with Claude Code