Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to upload using Android clients over WiFi #8549

Closed
ingroxd opened this issue Jun 8, 2021 · 20 comments
Closed

Fail to upload using Android clients over WiFi #8549

ingroxd opened this issue Jun 8, 2021 · 20 comments
Labels
bug needs info Waiting for info from user(s). Issues with this label will auto-stale. stale

Comments

@ingroxd
Copy link

ingroxd commented Jun 8, 2021

Steps to reproduce

  1. Connect to a WiFi
  2. Try to upload a file using Android Client

Expected behaviour

The file should be uploaded

Actual behaviour

The Android Client fails the upload with "Connection Error"

Notes

I don't know where to write additional notes, I am just leaving them here.
I am not using cloud flare, and I already read the issue nextcloud/server#17226.
After some troubleshooting I could solve the issue and address the problem to the cipher suites I was using in apache2.
In particular, I solved the issue using this configuration instead of this one.

During the troubleshooting I excluded that the issue was given by the reverse proxy and that using trusted_proxies as stated here didn't help.

As I said, I already solved the prolem, but I am not really satisfied because I could not address what the real problem is.
So I am just leaving my little experience here, hoping it could help someone (dev and users).

Server configuration

Operating system: Debian 10

Web server: Apache2

Database: PostgreSQL

PHP version: 7.3.27

Nextcloud version: 20.0.10

Updated from an older Nextcloud/ownCloud or fresh install: Fresh Install

Where did you install Nextcloud from: Manual installation, downloaded from here

Signing status:

Signing status
No errors have been found.

List of activated apps:

App list
Enabled:                                                                                                                                                                                                           
  - activity: 2.13.4                                                                                                                                                                                               
  - breezedark: 20.0.11                                                                                                                                                                                            
  - bruteforcesettings: 2.1.0                                                                                                                                                                                      
  - calendar: 2.2.2
  - cloud_federation_api: 1.3.0
  - contacts: 3.5.1
  - dav: 1.16.2
  - encryption: 2.8.1
  - federatedfilesharing: 1.10.2
  - files: 1.15.0
  - files_downloadactivity: 1.9.0
  - files_pdfviewer: 2.0.1
  - files_rightclick: 0.17.0
  - files_sharing: 1.12.2
  - files_trashbin: 1.10.1
  - files_versions: 1.13.0
  - files_videoplayer: 1.9.0
  - keeweb: 0.6.5
  - logreader: 2.5.0
  - lookup_server_connector: 1.8.0
  - metadata: 0.13.0
  - notes: 4.0.4
  - notifications: 2.8.0
  - oauth2: 1.8.0
  - password_policy: 1.10.1
  - privacy: 1.4.0
  - provisioning_api: 1.10.0
  - serverinfo: 1.10.0
  - settings: 1.2.0
  - text: 3.1.0
  - theming: 1.11.0
  - twofactor_backupcodes: 1.9.0
  - twofactor_totp: 5.0.0
  - updatenotification: 1.10.0
  - viewer: 1.4.0
  - workflowengine: 2.2.0

Nextcloud configuration:

Config report
{
    "system": {
        "filelocking.enabled": true,
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "dbindex": 0,
            "timeout": 1.5
        },
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.ingroxd.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "20.0.10.1",
        "overwrite.cli.url": "http:\/\/cloud.ingroxd.com",
        "htaccess.RewriteBase": "\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "maintenance": false,
        "loglevel": 2
    }
}

Are you using external storage, if yes which one: Local storage

Are you using encryption: yes, server side

Are you using an external user-backend, if yes which one: No

Client configuration

Browser: Android Client 3.16.1 (latest from f-droid)

Operating system: Android 10, Android 11

Logs

Web server error log

Web server error log
No errors or warnings reported.

Nextcloud log (data/nextcloud.log)

Nextcloud log
No errors or warnings reported.

Browser log

Note: I didn't use dev-client

Browser log
No errors or warnings reported.
@szaimen szaimen transferred this issue from nextcloud/server Jun 9, 2021
@szaimen
Copy link
Contributor

szaimen commented Jun 9, 2021

Hi, Thanks for your report!
I think this was due to an issue with TLS1.3 but should be fixed in the Android 3.16.1 release.

@szaimen szaimen closed this as completed Jun 9, 2021
@ingroxd
Copy link
Author

ingroxd commented Jun 9, 2021

Hi [:
Just for the records, I already have the 3.16.1 client (from f-droid) and the problem is still present.
I will update this post after the next client update [:
Cheers!

@losuler
Copy link

losuler commented Jun 13, 2021

I can confirm this issue wasn't fixed in the 3.16.1 Android release (Nextcloud is 21.0.2). It does appear this is a result of TLS 1.3 as I had it forced in Caddy and upon removing that and thus allowing TLS 1.2, this issue went away.

@szaimen szaimen reopened this Jun 13, 2021
@jtagcat
Copy link

jtagcat commented Jun 13, 2021

3.16.1 both f-droid and gplay; one phone yesterday could upload only 10/250 images over mobile data; today an another phone couldn't sign in to the app on WiFi, (but could on mobile data).

@tobiasKaminsky tobiasKaminsky added bug needs info Waiting for info from user(s). Issues with this label will auto-stale. labels Jun 14, 2021
@tobiasKaminsky
Copy link
Member

So this is not about TLS, but about Wifi?
Is there something special about your wifi?

@BenjaminSchlechter
Copy link

BenjaminSchlechter commented Jun 14, 2021

Thank you for these hints! Can confirm this behaviour:
TLS1.2 works, but TLS1.3 doesnt work via wifi (upload immediatly fails, download works) - but with mobile data TLS1.3 is fine.
Tested with Nextcloud Server 21.0.1 and 21.0.2 (Linux 5.11.4), in combination with the Andoid client: 3.16.0 und 3.16.1 (Android 10: LineageOS 17.1)

@pcking99
Copy link

pcking99 commented Jun 15, 2021

Thank you for these hints! Can confirm this behaviour:
TLS1.2 works, but TLS1.3 doesnt work via wifi (upload immediatly fails, download works) - but with mobile data TLS1.3 is fine.
Tested with Nextcloud Server 21.0.1 and 21.0.2 (Linux 5.11.4), in combination with the Andoid client: 3.16.0 und 3.16.1 (Android 10: LineageOS 17.1)

Confirming that TLS 1.3 seems to be problematic. Changed to TLS 1.2 in Cloudflare and I could upload files from my phone via WIFI.

Tested with Oneplus 8 Pro on Oxygen OS 11 app: 3.16.1

@hrk
Copy link
Contributor

hrk commented Jun 19, 2021

FWIW this is what is shown via adb logcat on the latest stable release from G-Play, when trying to upload a (random) file while connected through Wi-Fi.
06-18 12:06:18.791 16363 16363 V UploadsStorageManager: getUploads() returning 0 (0) rows after reading 1 pages 06-18 12:06:18.795 16363 16363 D UploadsStorageManager: QUERY: status==2 AND account_name== ? ROWID: -1 06-18 12:06:18.798 16363 16363 V UploadsStorageManager: getUploads() got 3 rows from page 0, 3 rows total so far, last ID 1 06-18 12:06:18.798 16363 16363 D UploadsStorageManager: QUERY: (status==2 AND account_name== ?) AND _id < ? ROWID: 1 06-18 12:06:18.802 16363 16363 V UploadsStorageManager: getUploads() got 0 rows from page 1, 3 rows total so far, last ID 1 06-18 12:06:18.802 16363 16363 V UploadsStorageManager: getUploads() returning 3 (3) rows after reading 2 pages 06-18 12:06:18.804 16584 16584 V onNotificationPostedCallBack: flags=98 06-18 12:06:18.806 19575 19575 D StatusBar: onNotificationPosted key=0|com.nextcloud.client|411|null|10174 isUpdate=false 06-18 12:06:18.808 16584 16584 V h : ret=0 06-18 12:06:18.814 19575 19575 D StatusBar: No peeking: unimportant notification: 0|com.nextcloud.client|411|null|10174 06-18 12:06:18.828 16584 16584 V onNotificationPostedCallBack: flags=98 06-18 12:06:18.829 16584 16584 V h : ret=0 06-18 12:06:18.854 19575 19575 D StatusBar: No peeking: unimportant notification: 0|com.nextcloud.client|411|null|10174 06-18 12:06:18.856 16363 16432 I System.out: null 06-18 12:06:18.856 16363 16432 E UploadFileOperation: Upload of /storage/emulated/0/Download/Pc_Access_Recover_Guide.pdf to /Pc_Access_Recover_Guide.pdf: No network connection 06-18 12:06:18.856 16363 16432 D UploadsStorageManager: updateDatabaseUploadResult uploadResult: RemoteOperationResult(mSuccess=false, mHttpCode=-1, mHttpPhrase=null, mException=null, mCode=NO_NETWORK_CONNECTION, message=null, getLogMessage=No network connection) upload: com.owncloud.android.operations.UploadFileOperation@4161212 06-18 12:06:18.859 16363 16432 V UploadsStorageManager: Updating /storage/emulated/0/Download/Pc_Access_Recover_Guide.pdf with status:UPLOAD_FAILED and result:NETWORK_CONNECTION (old:/storage/emulated/0/Download/Pc_Access_Recover_Guide.pdf status:UPLOAD_IN_PROGRESS result:-1) 06-18 12:06:18.859 16363 16432 V UploadsStorageManager: Updating /storage/emulated/0/Download/Pc_Access_Recover_Guide.pdf with status=UPLOAD_FAILED 06-18 12:06:18.862 16363 16432 D UploadsStorageManager: updateUpload returns with: 1 for file: /storage/emulated/0/Download/Pc_Access_Recover_Guide.pdf 06-18 12:06:18.862 16363 16432 D UploadsStorageManager: notifyObserversNow 06-18 12:06:18.862 16363 16432 D FileUploader: NotifyUploadResult with resultCode: NO_NETWORK_CONNECTION 06-18 12:06:18.865 16363 16432 D FileUploader: Stopping command after id 6 06-18 12:06:18.865 16363 16363 D UploadListAdapter: loadUploadItemsFromDb 06-18 12:06:18.869 1947 1947 D zhoumingliang: isinvrtest==false 06-18 12:06:18.872 19575 19575 D StatusBar: onNotificationPosted key=0|com.nextcloud.client|411|null|10174 isUpdate=true

After switching to mobile data, the upload got rescheduled and completed successfully. The troublesome part is the RemoteOperationResult that returns NO_NETWORK_CONNECTION, although the Wi-Fi connection works fine for everything else, including downloading files from the nextcloud app itself (as mentioned by OP).

@hrk
Copy link
Contributor

hrk commented Jun 19, 2021

Building & debugging the app (from master) on Android Studio, I can see that

returns status = -1, which causes isInternetWalled to return true.

The issue only happens on WiFi since the check is performed only when on Wi-Fi (why?) and is most likely in the usage of PlainClient, which (I can only guess) isn't able to handle TLS1.3.

@hrk
Copy link
Contributor

hrk commented Jun 19, 2021

FWIW
https://github.com/nextcloud/android-library/blob/165cbdc6b4a1c13ffc72afb6e604992e5a5d4506/src/main/java/com/nextcloud/common/PlainClient.kt#L54

this is where PlainClient gets initialized, using "TLSv1" as protocol string, mapping to values in https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#SSLContext
<<Supports RFC 2246: TLS version 1.0 ; may support other versions>>.
Up to Java 8, Oracle javadocs are capped at TLSv1.2

@hrk
Copy link
Contributor

hrk commented Jun 19, 2021

Ok, went further into the rabbit hole.
Android's own SSLContext documentation ( https://developer.android.com/reference/javax/net/ssl/SSLContext ) lists "TLSv1.3" for API 29+ (Android 10), "TLSv1.2" for API16+ (Jelly Bean).

I'm not into security protocols as much as I'd like to, so forgive me if the following suggestion makes no sense, but could the initiailzation in PlainClient.kt be made API dependant, targeting the highest available protocol for each API?

Furthermore: does the issue lie in the initialization of PlainClient (meaning it should be filed under the android-library project) or is it in the usage of PlainClient wrt isInternetWalled() method in ConnectivityServiceImpl (meaning this is the right place)?

@hrk
Copy link
Contributor

hrk commented Jun 19, 2021

@tobiasKaminsky I see you already made a pull request for centralizing TLS definition ( nextcloud/android-library#645 ). When the pull request is merged, this issue will be fixed too!

@github-actions
Copy link

This bug report did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

@github-actions github-actions bot added the stale label Jul 17, 2021
@jtagcat
Copy link

jtagcat commented Jul 17, 2021

unstale, pending

@github-actions github-actions bot removed the stale label Jul 17, 2021
@ingroxd
Copy link
Author

ingroxd commented Aug 11, 2021

Almost reached stale status, so I am here to unstale it.

I migrated to Nextcloud 21.0.3 (even though the bug is in the Android Client if I got it right).
To be sure, I just tested with client 3.16.1 (latest available) from F-Droid (same as issue) and the bug is (obv) still present.

@github-actions
Copy link

github-actions bot commented Sep 8, 2021

This bug report did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

@github-actions github-actions bot added the stale label Sep 8, 2021
@hrk
Copy link
Contributor

hrk commented Sep 8, 2021

Bug seems to be solved in latest stable (and published) release after the upstream fix in the android-library (nextcloud/android-library#645).

Sometimes I still see a notification of a failed upload, however it appears to be random and difficult to trace.

@ingroxd
Copy link
Author

ingroxd commented Sep 12, 2021

Tried the (f-droid) 3.17 release and seems to work just fine.
I didn't upload too many files so I didn't see a Failed Upload yet.

@hrk Do you think the failed uploads are related to the same bug?

@github-actions github-actions bot removed the stale label Sep 12, 2021
@hrk
Copy link
Contributor

hrk commented Sep 12, 2021

FWIW I think this bug could be closed and the remaining random issues I get could be related to sudden network loss or switching from wifi to mobile when the upload is supposed to happen.

@github-actions
Copy link

This bug report did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

@github-actions github-actions bot added the stale label Oct 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs info Waiting for info from user(s). Issues with this label will auto-stale. stale
Projects
None yet
Development

No branches or pull requests

8 participants