Skip to content

to many OCS Share API calls (endless loop) #415

Closed

Description

@schiessle

I use the latest ownCloud Android App (1.5.4).

Today I discovered that the battery of my mobile phone discharged quite fast. After looking at the battery settings I saw that 55% of the battery power was used by the ownCloud client. I disabled the android client for the rest of the day and enabled it at the evening again. Immediately it starts to connect to the ownCloud server again and starts loading.

I looked at the access.log of the ownCloud server and discovered that the android clients sends a lot of requests to the server, like:

178.10.26.92 - schiesbn [26/Feb/2014:19:51:12 +0100] "GET /ocs/v1.php/apps/files_sharing/api/v1/shares?path=%2Fpresentationen%2F&reshares=false&subfiles=true HTTP/1.1" 200 1020 "-" "Android-ownCloud"

It seems that it sends this request for every single file in my ownCloud. This can take really long and consume a lot of battery power for users with a lot of files.

I wonder why we don't send this requests only on demand for the files/folder we need the information?

Edit: After a few hours I even see repeated requests in my log, it seems that there is an endless loop sending this API calls.

Activity

  1. masensio commented on Feb 27, 2014

    @masensio

    Hi @schiesbn,

    Thanks for your feedback.

    When we implemented the refresh the shared files in the file list, we ask for shared files/folders for the current folder when changing the folder in the file list.

    In our test we haven't noticed this behavior, but we'll take a look to ensure this works properly.

    I need more details about your environment to try to reproduce the problem: device (Android version) and ownCloud server version. Could you provide me this information?

    Thanks in advance.

  2. schiessle commented on Feb 27, 2014

    @schiessle
    Author

    I need more details about your environment to try to reproduce the problem: device (Android version) and ownCloud server version. Could you provide me this information?

    Sure, device is a Samsung Galaxy Note 2 (GT-N7100) Android Version 4.3. Server: ownCloud 6.0.1

    As a additional note, this seems to happen only if I enable the auto sync in the android settings for the ownCloud client.

  3. PVince81 commented on Feb 28, 2014

    @PVince81

    I can confirm this and see two different issues.

    First, here are the steps to reproduce the issue:

    1. Close/kill the ownCloud Android app
    2. Go to the Android settings
    3. Click on "ownCloud" in the account list
    4. Enable automatic syncing (checkbox)
    5. Observe the server's access log and wait
    79.222.59.134 - vincent [28/Feb/2014:11:04:27 +0100] "GET /status.php HTTP/1.1" 200 78 "-" "Android-ownCloud"
    79.222.59.134 - vincent [28/Feb/2014:11:04:27 +0100] "PROPFIND /remote.php/webdav/ HTTP/1.1" 207 594 "-" "Android-ownCloud"
    79.222.59.134 - vincent [28/Feb/2014:11:04:27 +0100] "GET /ocs/v1.php/apps/files_sharing/api/v1/shares?path=%2F&reshares=false&subfiles=true HTTP/1.1" 200 1961 "-" "Android-ownCloud"
    79.222.59.134 - vincent [28/Feb/2014:11:04:27 +0100] "PROPFIND /remote.php/webdav/attachments/ HTTP/1.1" 207 604 "-" "Android-ownCloud"
    79.222.59.134 - vincent [28/Feb/2014:11:04:27 +0100] "GET /ocs/v1.php/apps/files_sharing/api/v1/shares?path=%2Fattachments%2F&reshares=false&subfiles=true HTTP/1.1" 200 127 "-" "Android-ownCloud"
    79.222.59.134 - vincent [28/Feb/2014:11:04:28 +0100] "PROPFIND /remote.php/webdav/attachments/adsr/ HTTP/1.1" 207 602 "-" "Android-ownCloud"
    79.222.59.134 - vincent [28/Feb/2014:11:04:28 +0100] "GET /ocs/v1.php/apps/files_sharing/api/v1/shares?path=%2Fattachments%2Fadsr%2F&reshares=false&subfiles=true HTTP/1.1" 200 127 "-" "Android-ownCloud"
    79.222.59.134 - vincent [28/Feb/2014:11:04:28 +0100] "PROPFIND /remote.php/webdav/attachments/work/ HTTP/1.1" 207 609 "-" "Android-ownCloud"
    79.222.59.134 - vincent [28/Feb/2014:11:04:28 +0100] "GET /ocs/v1.php/apps/files_sharing/api/v1/shares?path=%2Fattachments%2Fwork%2F&reshares=false&subfiles=true HTTP/1.1" 200 3124 "-" "Android-ownCloud"
    

    First issue: the sync seems to be triggered too often, at least once every 2-3 minutes or so. It is not configurable in Android, so not sure whether it's correct.

    Second issue: the sharing info is queried for all folders and subfolders even though the app isn't visible. I'd expect it to only retrieve the share info of the currently visible folder, not traversing all the folders. This means that if someone has many many subfolders it will take a long time for all the calls to be done which will hammer the server needlessly and also drain the battery.

    I did another test when the ownCloud app is opened in the root, but the result is the same: all directories are traversed.

    Device specs: Nexus 4 with Android 4.4.2

  4. davivel commented on Feb 28, 2014

    @davivel
    Contributor

    Interesting point: no need to get shares in the full-synchronization process. I think this is the best one (at least regarding shares).

    But we'll have to take care of the current folder if a refresh for full account is triggered.

  5. pgschk commented on Mar 2, 2014

    @pgschk

    Can confirm for this combination:

    Server:

    • ownCloud 6.0.1
    • Apache 2.4.7
    • php 5.5.9

    Client:

    • ownCloud 1.5.4
    • Android 4.4.2 (mostly) Stock on Nexus 7 2013 LTE (deb)

    Happy to do any testing if needed

  6. netAction commented on Mar 10, 2014

    @netAction

    I have the same logfile and the same issue with Android sync.

    Server 6.0.1
    Client 1.5.4

  7. pmarasse commented on Mar 12, 2014

    @pmarasse
    Contributor

    I'm experiencing a similar behavior since a few days on my phone (file sync activated on my OC account), but not on my tablet (file sync disabled)

    Server : 6.0.2-1 on Debian 7

    Client 1.5.4 (dev branch)
    Device : Sony Xperia ARC-S Android 4.0.4

    All of my path are scanned endlessly, logcat output looks like this for one path :

    https://orthanc.archigny.net/mydrive/public.php?service=files&t=04cdeda6c2eecdd9865be0f9102724c4

  8. ufgum commented on Mar 18, 2014

    @ufgum

    same behavior here! I have one file selected to keep in sync. Since the update to 1.5.4 the battery drains, but it depends on the network speed. If I'm on Wireless-LAN, it will be not noticeable. If I'm on a mobile Network, especially a slow one, the phone gets really hot and the battery drains fast.

    ownCloud 6.0.2 (stable)
    Client 1.5.4
    Android 4.2.2

  9. rperezb commented on Mar 26, 2014

    @rperezb

    Hey, we have just released a new version of the app, 1.5.5
    It is included to improve the battery usage, can you test it?
    thx

  10. PVince81 commented on Mar 27, 2014

    @PVince81

    @rperezb yes I saw the update yesterday. Syncing seemed to be a bit faster.

    The "share" requests are now limited to the directory I am currently browsing, so it looks like this part is fixes.

    The PROPFIND is still traversing all subdirs, but I suppose that it's expected. Shouldn't it be possible to just PROPFIND the root dir to find out whether there are changes, and only traverse if the etag has changed ? (probably a separate issue)

  11. davivel commented on Mar 27, 2014

    @davivel
    Contributor

    @PVince81 , yes, we tried to implement that this time, but found some problems. We think we can avoid it, but need to try it carefully and the impact of share requests was quite important to make it wait.

    A separate issue sounds fine.

  12. schiessle commented on Apr 4, 2014

    @schiessle
    Author

    I tried the latest release and everything seems to work again. 😄 Even with automatic sync enabled the client no longer updates the share information for ever. So from my side this issue is solved. Thanks!

  13. Fukurokudzu commented on Apr 20, 2014

    @Fukurokudzu

    Looks like i have high battery usage with 1.5.5 now. I've LG G2, and 4.4.2.

  14. pgschk commented on Apr 21, 2014

    @pgschk

    Looks fixed for me 4.4.2 and 1.5.5

  15. DPTJKKVH commented on May 8, 2014

    @DPTJKKVH

    The problem still persists in 1.5.5 but only on a directory level. But still it syncs in an endless loop. oC 6.0.2 here.

  16. davivel commented on May 22, 2014

    @davivel
    Contributor

    Since this issue was about the Share API calls, let's give it as solved and continue the discussion about battery and syncing in #462.

    Thanks.

  17. added a commit that references this issue on Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions