nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.26k stars 1.77k forks source link

Uploads fail with "Connection error" even though connection works (TLS1.3 broken for uploads, TLS1.2 OK) #8197

Closed moviuro closed 1 year ago

moviuro commented 3 years ago

Steps to reproduce

  1. Open Nextcloud
  2. Head to "Uploads"
  3. Tap a file with "Connection" error

Expected behaviour

Actual behaviour

Can you reproduce this problem on https://try.nextcloud.com?

Environment data

Android version: 11

Device model: Pixel 4a 5G

Stock or customized system: Stock

Nextcloud app version: 3.16.0 RC2

Nextcloud server version: 21.0.0 (PHP8)

Reverse proxy: haproxy+nginx

NB: my server only serves TLS 1.3 and requires SNI (the joys of having only IPv4 in this day and age)

Logs

Web server error log

No errors in log

Nextcloud log (data/nextcloud.log) (Android app log)

2021-03-21T20:02:28.924+0100;V;UploadsStorageManager;getUploads() got 0 rows from page 1, 9 rows total so far, last ID 1
2021-03-21T20:02:28.924+0100;V;UploadsStorageManager;getUploads() returning 9 (9) rows after reading 2 pages
2021-03-21T20:02:30.062+0100;E;UploadFileOperation;Upload of /storage/emulated/0/DCIM/Camera/PXL_20210319_092551675.jpg to /InstantUpload/Camera/PXL_20210319_092551675.jpg: No network connection
2021-03-21T20:02:30.062+0100;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@92c9df
2021-03-21T20:02:30.069+0100;V;UploadsStorageManager;Updating /storage/emulated/0/DCIM/Camera/PXL_20210319_092551675.jpg with status:UPLOAD_FAILED and result:NETWORK_CONNECTION (old:/storage/emulated/0/DCIM/Camera/PXL_20210319_092551675.jpg status:UPLOAD_IN_PROGRESS result:-1)
2021-03-21T20:02:30.070+0100;V;UploadsStorageManager;Updating /storage/emulated/0/DCIM/Camera/PXL_20210319_092551675.jpg with status=UPLOAD_FAILED
2021-03-21T20:02:30.075+0100;D;UploadsStorageManager;updateUpload returns with: 1 for file: /storage/emulated/0/DCIM/Camera/PXL_20210319_092551675.jpg
2021-03-21T20:02:30.075+0100;D;UploadsStorageManager;notifyObserversNow
2021-03-21T20:02:30.076+0100;D;FileUploader;NotifyUploadResult with resultCode: NO_NETWORK_CONNECTION
2021-03-21T20:02:30.081+0100;D;FileUploader;Stopping command after id 4
2021-03-21T20:02:30.081+0100;D;UploadListAdapter;loadUploadItemsFromDb
2021-03-21T20:02:30.083+0100;D;UploadsStorageManager;QUERY: status==0 OR last_result==9 OR last_result==13 OR last_result==11 OR last_result==14 AND account_name== ? ROWID: -1
2021-03-21T20:02:30.086+0100;V;UploadsStorageManager;getUploads() got 0 rows from page 0, 0 rows total so far, last ID -1
2021-03-21T20:02:30.086+0100;V;UploadsStorageManager;getUploads() returning 0 (0) rows after reading 1 pages
2021-03-21T20:02:30.088+0100;D;UploadsStorageManager;QUERY: status==1 AND last_result<>9 AND last_result<>13 AND last_result<>11 AND last_result<>14 AND account_name== ? ROWID: -1
2021-03-21T20:02:30.090+0100;V;UploadsStorageManager;getUploads() got 3 rows from page 0, 3 rows total so far, last ID 9
2021-03-21T20:02:30.090+0100;D;UploadsStorageManager;QUERY: (status==1 AND last_result<>9 AND last_result<>13 AND last_result<>11 AND last_result<>14 AND account_name== ?) AND _id < ? ROWID: 9
2021-03-21T20:02:30.093+0100;V;UploadsStorageManager;getUploads() got 0 rows from page 1, 3 rows total so far, last ID 9
2021-03-21T20:02:30.093+0100;V;UploadsStorageManager;getUploads() returning 3 (3) rows after reading 2 pages
2021-03-21T20:02:30.094+0100;D;UploadsStorageManager;QUERY: status==2 AND account_name== ? ROWID: -1
2021-03-21T20:02:30.097+0100;V;UploadsStorageManager;getUploads() got 9 rows from page 0, 9 rows total so far, last ID 1
2021-03-21T20:02:30.097+0100;D;UploadsStorageManager;QUERY: (status==2 AND account_name== ?) AND _id < ? ROWID: 1
2021-03-21T20:02:30.099+0100;V;UploadsStorageManager;getUploads() got 0 rows from page 1, 9 rows total so far, last ID 1
2021-03-21T20:02:30.099+0100;V;UploadsStorageManager;getUploads() returning 9 (9) rows after reading 2 pages

NOTE: Be super sure to remove sensitive data like passwords, note that everybody can look here! You can use the Issue Template application to prefill some of the required information: https://apps.nextcloud.com/apps/issuetemplate

Network trace

# tcpdump -tttnei bge0 port https
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on bge0, link-type EN10MB (Ethernet), capture size 262144 bytes
 00:00:00.000000 78:81:02:2e:5c:d4 > 98:f2:b3:e6:4d:54, ethertype IPv4 (0x0800), length 74: 151.80.43.167.64842 > 192.168.1.100.443: Flags [S], seq 3460956079, win 65535, options [mss 1240,sackOK,TS val 58825446 ecr 0,nop,wscale 8], length 0
 00:00:00.000091 98:f2:b3:e6:4d:54 > 78:81:02:2e:5c:d4, ethertype IPv4 (0x0800), length 74: 192.168.1.100.443 > 151.80.43.167.64842: Flags [S.], seq 1199358745, ack 3460956080, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 3924191486 ecr 58825446], length 0
 00:00:00.030865 78:81:02:2e:5c:d4 > 98:f2:b3:e6:4d:54, ethertype IPv4 (0x0800), length 66: 151.80.43.167.64842 > 192.168.1.100.443: Flags [.], ack 1, win 256, options [nop,nop,TS val 58825492 ecr 3924191486], length 0
 00:00:00.001818 78:81:02:2e:5c:d4 > 98:f2:b3:e6:4d:54, ethertype IPv4 (0x0800), length 243: 151.80.43.167.64842 > 192.168.1.100.443: Flags [P.], seq 1:178, ack 1, win 256, options [nop,nop,TS val 58825494 ecr 3924191486], length 177
 00:00:00.000771 98:f2:b3:e6:4d:54 > 78:81:02:2e:5c:d4, ethertype IPv4 (0x0800), length 73: 192.168.1.100.443 > 151.80.43.167.64842: Flags [P.], seq 1:8, ack 178, win 1027, options [nop,nop,TS val 3924191518 ecr 58825494], length 7
 00:00:00.000015 98:f2:b3:e6:4d:54 > 78:81:02:2e:5c:d4, ethertype IPv4 (0x0800), length 66: 192.168.1.100.443 > 151.80.43.167.64842: Flags [F.], seq 8, ack 178, win 1027, options [nop,nop,TS val 3924191519 ecr 58825494], length 0
 00:00:00.029404 78:81:02:2e:5c:d4 > 98:f2:b3:e6:4d:54, ethertype IPv4 (0x0800), length 66: 151.80.43.167.64842 > 192.168.1.100.443: Flags [.], ack 8, win 256, options [nop,nop,TS val 58825524 ecr 3924191518], length 0
 00:00:00.003012 78:81:02:2e:5c:d4 > 98:f2:b3:e6:4d:54, ethertype IPv4 (0x0800), length 66: 151.80.43.167.64842 > 192.168.1.100.443: Flags [F.], seq 178, ack 9, win 256, options [nop,nop,TS val 58825527 ecr 3924191519], length 0
 00:00:00.000082 98:f2:b3:e6:4d:54 > 78:81:02:2e:5c:d4, ethertype IPv4 (0x0800), length 66: 192.168.1.100.443 > 151.80.43.167.64842: Flags [.], ack 179, win 1026, options [nop,nop,TS val 3924191552 ecr 58825527], length 0
 00:00:05.222193 98:f2:b3:e6:4d:54 > 78:81:02:2e:5c:d4, ethertype IPv4 (0x0800), length 129: 192.168.1.100.443 > 151.80.43.167.52761: Flags [P.], seq 3743102473:3743102536, ack 2447182969, win 1035, options [nop,nop,TS val 1426787209 ecr 1365080257], length 63
 00:00:00.000038 98:f2:b3:e6:4d:54 > 78:81:02:2e:5c:d4, ethertype IPv4 (0x0800), length 66: 192.168.1.100.443 > 151.80.43.167.52761: Flags [F.], seq 63, ack 1, win 1035, options [nop,nop,TS val 1426787209 ecr 1365080257], length 0
 00:00:00.025787 78:81:02:2e:5c:d4 > 98:f2:b3:e6:4d:54, ethertype IPv4 (0x0800), length 66: 151.80.43.167.52761 > 192.168.1.100.443: Flags [.], ack 63, win 502, options [nop,nop,TS val 1365260264 ecr 1426787209], length 0
 00:00:00.000058 78:81:02:2e:5c:d4 > 98:f2:b3:e6:4d:54, ethertype IPv4 (0x0800), length 66: 151.80.43.167.52761 > 192.168.1.100.443: Flags [F.], seq 1, ack 64, win 502, options [nop,nop,TS val 1365260265 ecr 1426787209], length 0
 00:00:00.000042 98:f2:b3:e6:4d:54 > 78:81:02:2e:5c:d4, ethertype IPv4 (0x0800), length 66: 192.168.1.100.443 > 151.80.43.167.52761: Flags [.], ack 2, win 1035, options [nop,nop,TS val 1426787235 ecr 1365260265], length 0
tobiasKaminsky commented 2 years ago

Sorry, I as this issue is very long, I did not checked if everyone reporting it really reported that it is fixed. It seems also that there are different problems/symptoms mixed in this issue.

@jerheij Can you create us a test account, test if the problem occurs also there and if so send the credentials to tobias at nextcloud dot com with a reference to this issue?

jerheij commented 2 years ago

Sorry, I as this issue is very long, I did not checked if everyone reporting it really reported that it is fixed. It seems also that there are different problems/symptoms mixed in this issue.

@jerheij Can you create us a test account, test if the problem occurs also there and if so send the credentials to tobias at nextcloud dot com with a reference to this issue?

Thanks @tobiasKaminsky ! You should have received a welcome email and another email from me.

tobiasKaminsky commented 2 years ago

@jerheij I logged in and uploaded a small and a big file manually without problems. Is this purely on auto upload?

jerheij commented 2 years ago

@tobiasKaminsky this is indeed purely on auto upload I had configured on my mobile phone for pictures. See below for my initial reported issue:

Still happening for me with Nextcloud 22 and the newest Android version of the app. For me my first auto upload (picture) doesn't even finish but just stops half way. I feel like the upload gets "further" before it stops when I switch to TLS1.2 instead of 1.3.

When I use my wireguard VPN, even though I still access the service externally, it all works as expected. When I turn off wireguard I experience those symptoms.

My setup runs on a VPS on the internet, so the external IPs are assigned to the server directly so no need for NATing or port forwarding.

Nextcloud server: 22.0.0 Nextcloud android app: 3.18.1 Reverse proxy: nginx

Uploads didn't seem to finish properly or get "stuck". While with the photosync app I am currently using it works without issues so far.

tobiasKaminsky commented 2 years ago

I enabled auto upload, uploaded 10 images (as of emulator they are rather small), and then I uploaded a 10mb video also via auto upload. All is working.

Which Android OS version do you use?

jerheij commented 2 years ago

I am on Android 12 on Samsung.

Just tested it again, they keep failing after reaching about 50%. This is the last message I receive on my nginx reverse proxy: [23/Jun/2022:14:12:07 +0200] "PUT /remote.php/dav/uploads/<account>/<random numbers>/0000000000000000-0000000001023999 HTTP/1.1" 408 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"

hannibal218bc commented 2 years ago

Hi,

for me, the uploads fail immediately. The server log (Apache) says:

192.168.27.175 - - [23/Jun/2022:21:37:31 +0200] "GET /index.php/204 HTTP/1.1" 302 6334 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
192.168.27.175 - - [23/Jun/2022:21:37:31 +0200] "GET /index.php/login HTTP/1.1" 200 3243 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"

On the mobile, this is the only information I receive: Screenshot_20220623-213807

I'd be happy to provide more details? The mobile is on Android 11.

TheHappyAkita commented 2 years ago

Maybe another hint to that topic. Today I found the problem occurring when uploading a JPG file (rather a large one) and then shutting down the server side during upload. After reestablishing the connection I was not able to upload the same image within in the mobile app (Connection Error always shown). Even after restarts of the app and the server.

When I renamed the image on phone side I was able to upload it. Also other images could be uploaded.

Hope it may help.

bpaplow commented 2 years ago

I had the exact same result, would not upload no matter what was restarted but a rename of the problem file allowed auto upload to proceed again.

AnantaSrikar commented 1 year ago

I was facing the same issue. Clearing cache and reopening the application helped resume the uploads for me.

joshtrichards commented 1 year ago

In conclusion, the follow-up comments are unrelated to the original report (which has been resolved). :) If anyone here continues to have problems, please open an independent Issue so that the matter can be looked at individually and not mingled with unrelated matters. Thanks everyone for your contributions!