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

[BUG] Error when downloading files on my personal server #3800

Closed
nuxlight opened this issue Nov 30, 2022 · 14 comments
Closed

[BUG] Error when downloading files on my personal server #3800

nuxlight opened this issue Nov 30, 2022 · 14 comments

Comments

@nuxlight
Copy link

nuxlight commented Nov 30, 2022

Actual behaviour

  • When i want to download a file on my server i have this error (from debug) :

Expected behaviour

  • My file shoudl be downloaded

Steps to reproduce

  1. Upload file from the web interface
  2. Download the Android app
  3. Try to download this file

Can this problem be reproduced with the official owncloud server? No
(url: https://demo.owncloud.org, user: test, password: test)

Environment data

Android version: 12

Device model: A21s

Stock or customized system: Stock

ownCloud app version:

ownCloud server version: OCIS v2.0

Logs

ownCloud android log

D: 2022-11-30 11:21:59:606(DownloadFileOperation.java:162) .run()Save path: /data/user/0/com.owncloud.android/files/owncloud/admin@xxxxxxxx/xxxxx.pdf
D: 2022-11-30 11:21:59:608(DownloadFileOperation.java:165) .run()Creation of parent folder /data/user/0/com.owncloud.android/files/owncloud/admin@xxxxxxxx succeeded: true
D: 2022-11-30 11:21:59:610(DownloadFileOperation.java:166) .run()Parent folder /data/user/0/com.owncloud.android/files/owncloud/admin@xxxxxxxx exists: true
D: 2022-11-30 11:21:59:612(DownloadFileOperation.java:167) .run()Parent folder /data/user/0/com.owncloud.android/files/owncloud/admin@xxxxxxxx is directory: true
D: 2022-11-30 11:21:59:614(DownloadFileOperation.java:169) .run()New file /data/user/0/com.owncloud.android/files/owncloud/admin@xxxxxxxx/xxxxx.pdf exists: false
D: 2022-11-30 11:21:59:616(DownloadFileOperation.java:170) .run()New file /data/user/0/com.owncloud.android/files/owncloud/admin@xxxxxxxx/xxxxx.pdf is directory: false
I: 2022-11-30 11:21:59:618(DownloadFileOperation.java:176) .run()Download of /xxxxx.pdf to : Error while moving file to final directory
@nuxlight
Copy link
Author

Works on iOS device

@JuancaG05
Copy link
Collaborator

Hi @nuxlight! Thanks for opening a issue! 🍻

Within this and the next week, we plan to release the big 3.0 version of the app, in which we replaced the operations (for example, DownloadFileOperation.java) by usecases that work in a different way (mainly with workers). We hope this solves your problem. Meanwhile, you can try the 3.0-beta.3 released last Friday, where we already include the replacement of the operations. More info: https://central.owncloud.org/t/owncloud-3-0-beta-2-for-android/39497/8

Check it and let us know please! Any more feedback is always welcome of course! 👍

@nuxlight
Copy link
Author

nuxlight commented Dec 5, 2022

Hi @JuancaG05 😃
Thanks a lot for your feedback !
I will test the beta version now ;)

@nuxlight
Copy link
Author

nuxlight commented Dec 5, 2022

Sorry @JuancaG05, but I already have an error with the 3.0-beta3
I checked and I have correctly authorized file system access

logs here :

I: 2022-12-05 13:46:05:980(ReadRemoteFileOperation.kt:69) .run()Read remote file /MY_FILE.pdf with status 207
I: 2022-12-05 13:46:05:982(SynchronizeFileUseCase.kt:57) .run()File MY_FILE.pdf is not downloaded. Let's download it
I: 2022-12-05 13:46:05:988(DownloadFileUseCase.kt:103) .enqueueNewDownload()Download of MY_FILE.pdf has been enqueued.
D: 2022-12-05 13:46:05:990(ViewModelExt.kt:64) $runUseCaseWithResult.invokeSuspend()Use case executed: SynchronizeFileUseCase with result: Success(data=DownloadEnqueued(workerId=4dfecbf0-65f9-4b8b-8fcf-b82f176d8fd3))
D: 2022-12-05 13:46:06:035(SingleSessionManager.java:99) .getClientFor()getClientFor starting 
V: 2022-12-05 13:46:06:037(SingleSessionManager.java:126) .getClientFor()reusing client for account admin@ocis.xxxxxx.com
D: 2022-12-05 13:46:06:038(SingleSessionManager.java:163) .getClientFor()getClientFor finishing 
D: 2022-12-05 13:46:06:043(OwnCloudClient.java:128) .saveExecuteHttpMethod()Executing in request with id fec64ada-75b4-4697-ab31-feffec5d1c9b
E: 2022-12-05 13:46:06:773(DownloadRemoteFileOperation.kt:143) .downloadFile()Content-Length not equal to transferred bytes.
D: 2022-12-05 13:46:06:775(DownloadRemoteFileOperation.kt:144) .downloadFile()totalToTransfer = 0, transferred = 126045
I: 2022-12-05 13:46:06:778(DownloadRemoteFileOperation.kt:70) .run()Download of /MY_FILE.pdf to /data/user/0/com.owncloud.android/files/owncloud/tmp/admin@ocis.xxxxxx.com/MY_FILE.pdf: Operation finished with HTTP status code -1 (success)
E: 2022-12-05 13:46:06:782(DownloadFileWorker.kt:123) .doWork()com.owncloud.android.domain.exceptions.LocalStorageNotMovedException
	at com.owncloud.android.workers.DownloadFileWorker.moveTemporalFileToFinalLocation(DownloadFileWorker.kt:192)
	at com.owncloud.android.workers.DownloadFileWorker.doWork(DownloadFileWorker.kt:119)
	at androidx.work.CoroutineWorker$startWork$1.invokeSuspend(CoroutineWorker.kt:68)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

I: 2022-12-05 13:46:08:217(AvatarManager.kt:87) .getAvatarForAccount()Avatar with imageKey a_admin@ocis.xxxxxx.com is not available in cache. Generating one...
V: 2022-12-05 13:46:09:810(FileDisplayActivity.kt:706) .onPause()onPause() start
V: 2022-12-05 13:46:09:812(MainApp.kt:142) $onCreate.onActivityPaused()FileDisplayActivity onPause() ending
V: 2022-12-05 13:46:09:813(FileDisplayActivity.kt:717) .onPause()onPause() end
D: 2022-12-05 13:46:09:832(MainApp.kt:102) $onCreate.onActivityCreated()SettingsActivity onCreate(Bundle) starting
V: 2022-12-05 13:46:09:859(MainApp.kt:129) $onCreate.onActivityStarted()SettingsActivity onStart() starting
V: 2022-12-05 13:46:09:870(MainApp.kt:138) $onCreate.onActivityResumed()SettingsActivity onResume() starting
V: 2022-12-05 13:46:10:216(MainApp.kt:146) $onCreate.onActivityStopped()FileDisplayActivity onStop() ending
V: 2022-12-05 13:46:10:220(FileDisplayActivity.kt:672) .onSaveInstanceState()onSaveInstanceState() start
V: 2022-12-05 13:46:10:222(MainApp.kt:155) $onCreate.onActivitySaveInstanceState()FileDisplayActivity onSaveInstanceState(Bundle) starting
V: 2022-12-05 13:46:10:223(FileDisplayActivity.kt:682) .onSaveInstanceState()onSaveInstanceState() end
V: 2022-12-05 13:46:11:895(MainApp.kt:142) $onCreate.onActivityPaused()SettingsActivity onPause() ending
D: 2022-12-05 13:46:11:914(MainApp.kt:102) $onCreate.onActivityCreated()LogsListActivity onCreate(Bundle) starting
V: 2022-12-05 13:46:11:935(MainApp.kt:129) $onCreate.onActivityStarted()LogsListActivity onStart() starting
V: 2022-12-05 13:46:11:937(MainApp.kt:138) $onCreate.onActivityResumed()LogsListActivity onResume() starting
V: 2022-12-05 13:46:12:222(MainApp.kt:146) $onCreate.onActivityStopped()SettingsActivity onStop() ending
V: 2022-12-05 13:46:12:225(MainApp.kt:155) $onCreate.onActivitySaveInstanceState()SettingsActivity onSaveInstanceState(Bundle) starting
V: 2022-12-05 13:46:12:951(MainApp.kt:142) $onCreate.onActivityPaused()LogsListActivity onPause() ending
V: 2022-12-05 13:46:18:264(MainApp.kt:146) $onCreate.onActivityStopped()LogsListActivity onStop() ending
V: 2022-12-05 13:46:18:272(MainApp.kt:155) $onCreate.onActivitySaveInstanceState()LogsListActivity onSaveInstanceState(Bundle) starting
V: 2022-12-05 13:46:20:746(MainApp.kt:129) $onCreate.onActivityStarted()LogsListActivity onStart() starting

Unfortley, I don't have time now to launch the app in debug mod, maybe this evening

@JuancaG05
Copy link
Collaborator

Ok @nuxlight, thanks a lot for the logs! These are more useful since they use the new code. We'll take a look and will let you know! 👍

@jesmrec
Copy link
Collaborator

jesmrec commented Dec 7, 2022

@nuxlight i can not reproduce the problem with Android 3.0-beta.3 against oCIS 2.0.0. Some extra details could help. Could you attach the file you reproduce the problem? or happens with any file? Would it be posible to get a test account in your server? in order to try to reproduce from here (forward to android-app@owncloud.com)

@nuxlight
Copy link
Author

nuxlight commented Dec 7, 2022

Okay I've configured the project in Android Studio to have the LogCat, here are the logs :

D/(OwnCloudClient.java:130) .saveExecuteHttpMethod(): Executing in request with id 0b60dd41-1dcb-4e3f-80a1-abfec3d89c73
I/IMM_LC: hsifw() - flags=0, caller=android.view.inputmethod.InputMethodManager.hideSoftInputFromWindow:1846 android.view.inputmethod.InputMethodManager.hideSoftInputFromWindow:1815 androidx.appcompat.widget.SearchView$SearchAutoComplete.setImeVisibility:2013 androidx.appcompat.widget.SearchView.clearFocus:504 androidx.appcompat.widget.SearchView.onActionViewCollapsed:1287 
I/IMM_LC: hsifw() ignore mServedView == null or mServedView.getWindowToken() != windowToken, mServedView :DecorView@fb7b210[FileDisplayActivity]
E/(DownloadRemoteFileOperation.java:162) .downloadFile(): Content-Length not equal to transferred bytes.
D/(DownloadRemoteFileOperation.java:163) .downloadFile(): totalToTransfer = 0, transferred = 544732
I/(DownloadRemoteFileOperation.java:83) .run(): Download of /Bach-Prelude-BWV1006a-Guitar.pdf to /data/user/0/com.owncloud.android.debug/files/owncloud/tmp/admin@ocis.server.com/Bach-Prelude-BWV1006a-Guitar.pdf: Operation finished with HTTP status code -1 (success)
D/(DownloadFileOperation.java:162) .run(): Save path: /data/user/0/com.owncloud.android.debug/files/owncloud/admin@ocis.server.com/Bach-Prelude-BWV1006a-Guitar.pdf
D/(DownloadFileOperation.java:165) .run(): Creation of parent folder /data/user/0/com.owncloud.android.debug/files/owncloud/admin@ocis.server.com succeeded: false
D/(DownloadFileOperation.java:166) .run(): Parent folder /data/user/0/com.owncloud.android.debug/files/owncloud/admin@ocis.server.com exists: true
D/(DownloadFileOperation.java:167) .run(): Parent folder /data/user/0/com.owncloud.android.debug/files/owncloud/admin@ocis.server.com is directory: true
D/(DownloadFileOperation.java:169) .run(): New file /data/user/0/com.owncloud.android.debug/files/owncloud/admin@ocis.server.com/Bach-Prelude-BWV1006a-Guitar.pdf exists: false
D/(DownloadFileOperation.java:170) .run(): New file /data/user/0/com.owncloud.android.debug/files/owncloud/admin@ocis.server.com/Bach-Prelude-BWV1006a-Guitar.pdf is directory: false
I/(DownloadFileOperation.java:176) .run(): Download of /Bach-Prelude-BWV1006a-Guitar.pdf to /data/user/0/com.owncloud.android.debug/files/owncloud/admin@ocis.server.com/Bach-Prelude-BWV1006a-Guitar.pdf: Error while moving file to final directory
V/(FileDownloader.java:480) .downloadFile(): Success OR fail without exception for /Bach-Prelude-BWV1006a-Guitar.pdf in admin@ocis.server.com
D/(FileDownloader.java:393) $ServiceHandler.handleMessage(): Stopping after command with id 2

I try to add a breakpoint on line 164 (on DownloadFileOperation class) and with the function parent.mkdirs() you can see we have a false result

image

Here is the value of parents variable 👇
/data/user/0/com.owncloud.android.debug/files/owncloud/admin@ocis.xxxxx.com

@nuxlight
Copy link
Author

nuxlight commented Dec 9, 2022

You have a mail @jesmrec to test on my server instance 👍

@jesmrec
Copy link
Collaborator

jesmrec commented Dec 12, 2022

@nuxlight You sent the credentials , but the URL

@nuxlight
Copy link
Author

@jesmrec Sorry... I re-send you a mail with thiat 👍

@jesmrec
Copy link
Collaborator

jesmrec commented Dec 13, 2022

Thanks a lot @nuxlight!

I was able to reproduce the problem, and i got the stacktrace posted above. So, i checked the network dialog to scope some differences with the expected behaviour.

Both servers (nuxlight's and mine's) have the same status:

{
    "installed": true,
    "maintenance": false,
    "needsDbUpgrade": false,
    "version": "10.11.0.0",
    "versionstring": "10.11.0",
    "edition": "Community",
    "productname": "Infinite Scale",
    "product": "Infinite Scale",
    "productversion": "2.0.0"
}

so, we are running same stuff. Next step. Perform download of same file in same location in both servers, checking the network dialog. Both return 200 but response headers differ a little bit

Headers in nuxlight's server:

Screenshot 2022-12-13 at 10 58 48

Headers in my server:

Screenshot 2022-12-13 at 11 03 13

There are some differences but the main difference, attending the known info is Content-Length header is missing in nuxlight's. That matches with the error above:

E: 2022-12-05 13:46:06:773(DownloadRemoteFileOperation.kt:143) .downloadFile()Content-Length not equal to transferred bytes.
D: 2022-12-05 13:46:06:775(DownloadRemoteFileOperation.kt:144) .downloadFile()totalToTransfer = 0, transferred = 126045

Why both servers, under the same version, sent different responses to the same action? don't have an answer for that yet. Any special server setup on your side @nuxlight?

Are you reproducing the problem with ocis.owncloud.com? (test server)

After these checks your server seems to be down now

@nuxlight
Copy link
Author

Yes I have a reverse proxy Traefik in front of my ocis server.
I have tested with the test server and I have no problem.
I will check this header difference with Traefik configurations 👍

@nuxlight
Copy link
Author

nuxlight commented Dec 14, 2022

Okay I think we found the problem !!! 😄 @jesmrec

I have added this middleware on my Traefik configuration : gzip

labels:
      - "traefik.enable=true"
      - "traefik.http.middlewares.gzip.compress=true"
      - "traefik.http.routers.ocis.middlewares=gzip@docker"
      - "traefik.http.routers.ocis.rule=Host(`ocis.wwww.xxxxx`)"
      - "traefik.http.routers.ocis.tls=true"
      - "traefik.http.routers.ocis.tls.certresolver=myresolver"
      - "traefik.http.services.ocis.loadbalancer.server.port=9200"

I Just remove this middleware, and now I can download files, so I think this is why you don't see the content-lenght information on the headers.

@jesmrec
Copy link
Collaborator

jesmrec commented Dec 15, 2022

Ok! so, we can close this one. Thanks anyway for reporting, and please reopen if any other related issue arises.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants