Skip to content

remote thumbnails are really slow and unreliable #921

Closed

Description

@mbiebl

I run OC 8.0.2 and the latest android client 1.7.0

I have several folders with larger amounts of photos and the remote thumbnail feature is extremly slow and unreliable.
I often have to explicitly refresh in the client for it to start showing thumbnails and it takes about a second to load one thumbnail. It also happens quite often, that the client simply stops loading new thumbnails and I have to hit refresh again.
In a folde with 500 photos, this is quite frustrating.

Activity

  1. mbiebl commented on Mar 18, 2015

    @mbiebl
    Author

    Also, if I scroll around, say to the middle of the folder, the client should continue there to load the thumbnails, not simply from top to bottom.

  2. mbiebl commented on Mar 18, 2015

    @mbiebl
    Author

    I see the owncloud log flooded with
    Cannot modify header information - headers already sent by (output started at /www/htdocs/owncloud/lib/private/image.php:249) at /www/htdocs/owncloud/lib/private/appframework/app.php#104

    Not sure if that's related

    owncloud/core#14378

  3. ddijak commented on Mar 18, 2015

    @ddijak

    The only problem here is that there is DiskLruImageCache used as L1 caching method. This causes I/O lagging that we see in the list/grid view. The proper method would be to use L1 memory cache and L2 disk cache. Thats what I did on my build and now it works as a charm. Plus im getting thumbnails from my ownCloud 7 server.

  4. masensio commented on Mar 19, 2015

    @masensio

    Hi @mbiebl,

    thanks for your feedback. We will have in mind this delay when loading the thumbnails in future improvements.
    Thanks @Skymania for your knowledge about caching method, we will take into account to improve this feature.

  5. tobiasKaminsky commented on Mar 19, 2015

    @tobiasKaminsky
    Contributor

    @Skymania Maybe you can point me to a good tutorial or howto?
    Or maybe just post the changes you have done.
    Then I will implement it.
    Thank you

  6. ddijak commented on Mar 21, 2015

    @ddijak

    @tobiasKaminsky I will as soon as I figure out why the getView method on FileListListAdapter is called multiple times for each View. I causes image flickering and I am already going nuts going threw the code.... People who commit should really start writing comments ...

  7. tobiasKaminsky commented on Mar 22, 2015

    @tobiasKaminsky
    Contributor

    The getView is called for each row (or item on the gridView) separately.
    As you can have different views for each row.
    But this should not cause the flickering as the view is only instantiated when it gets displayed. Moving it around in the visible part of the display should recycle this view.
    Also if an old view gets out of the display this view gets recycled.

  8. ddijak commented on Mar 22, 2015

    @ddijak

    03-22 14:47:12.379 2532-2532/com.owncloud.android I/art﹕ Not late-enabling -Xcheck:jni (already on)
    03-22 14:47:12.478 2532-2532/com.owncloud.android D/Debug﹕ start logging
    03-22 14:47:12.512 2532-2548/com.owncloud.android E/Memory THUMB CACHE﹕ initiated
    03-22 14:47:12.513 2532-2548/com.owncloud.android D/ThumbnailsCacheManager﹕ create dir: /storage/sdcard/Android/data/com.owncloud.android/cache/thumbnailCache
    03-22 14:47:12.529 2532-2532/com.owncloud.android D/FileDisplayActivity﹕ onCreate() start
    03-22 14:47:12.615 2532-2532/com.owncloud.android A/FileDisplayActivity﹕ Access to unexisting list of files fragment!!
    03-22 14:47:12.618 2532-2532/com.owncloud.android E/FileDisplayActivity﹕ OCFileListFragment is null
    03-22 14:47:12.619 2532-2532/com.owncloud.android D/FileDisplayActivity﹕ onCreate() end
    03-22 14:47:12.627 2532-2532/com.owncloud.android E/OCFileListFragment﹕ onAttach
    03-22 14:47:12.629 2532-2532/com.owncloud.android D/ExtendedListFragment﹕ onCreateView
    03-22 14:47:12.642 2532-2532/com.owncloud.android E/OCFileListFragment﹕ onActivityCreated() start
    03-22 14:47:12.652 2532-2532/com.owncloud.android D/FileDisplayActivity﹕ Initializing Fragments in onAccountChanged..
    03-22 14:47:12.659 2532-2532/com.owncloud.android D/FileDisplayActivity﹕ onResume() start
    03-22 14:47:12.662 2532-2551/com.owncloud.android D/SimpleFactoryManager﹕ getClientFor(OwnCloudAccount ... :
    03-22 14:47:12.666 2532-2551/com.owncloud.android D/NetworkUtils﹕ Searching known-servers store at /data/data/com.owncloud.android/files/knownServers.bks
    03-22 14:47:12.675 2532-2532/com.owncloud.android D/FileDisplayActivity﹕ onResume() end
    03-22 14:47:12.685 2532-2551/com.owncloud.android D/OwnCloudClient #0﹕ Creating OwnCloudClient
    03-22 14:47:12.721 2532-2532/com.owncloud.android D/OperationsService﹕ Creating service
    03-22 14:47:12.742 2532-2532/com.owncloud.android D/FileDownloader﹕ Creating service
    03-22 14:47:12.745 2532-2532/com.owncloud.android D/FileUploader﹕ Creating service
    03-22 14:47:12.748 2532-2532/com.owncloud.android D/FileObserverService﹕ onCreate
    03-22 14:47:12.749 2532-2532/com.owncloud.android D/FileObserverService﹕ Starting command Intent { act=com.owncloud.android.services.observer.FileObserverService.action.START_OBSERVATION cmp=com.owncloud.android/.services.observer.FileObserverService }
    03-22 14:47:12.760 2532-2532/com.owncloud.android D/FileObserverService﹕ Loading all kept-in-sync files from database to start watching them
    03-22 14:47:12.767 2532-2551/com.owncloud.android D/OwnCloudClient #0﹕ REQUEST GET /status.php
    03-22 14:47:12.772 2532-2551/com.owncloud.android D/AdvancedSslSocketFactory﹕ Creating SSL Socket with remote cloud.synox.si:443, local null:0, params: org.apache.commons.httpclient.params.HttpConnectionParams@2fc702cc
    03-22 14:47:12.773 2532-2551/com.owncloud.android D/AdvancedSslSocketFactory﹕ ... with connection timeout 60000 and socket timeout 60000
    03-22 14:47:12.794 2532-2532/com.owncloud.android I/CreateView﹕ 0 null
    03-22 14:47:12.808 2532-2532/com.owncloud.android I/CreateView﹕ 1 null
    03-22 14:47:12.857 2532-2544/com.owncloud.android W/art﹕ Suspending all threads took: 25.712ms
    03-22 14:47:12.869 2532-2532/com.owncloud.android I/CreateView﹕ 2 null
    03-22 14:47:12.910 2532-2544/com.owncloud.android I/art﹕ Background sticky concurrent mark sweep GC freed 14543(1059KB) AllocSpace objects, 31(500KB) LOS objects, 0% free, 2MB/2MB, paused 31.029ms total 422.278ms
    03-22 14:47:12.948 2532-2551/com.owncloud.android D/UpdateOCVersionOperation﹕ Got new OC version 8.0.2.0
    03-22 14:47:12.964 2532-2532/com.owncloud.android I/CreateView﹕ 3 null
    03-22 14:47:12.966 2532-2532/com.owncloud.android I/CreateView﹕ 4 null
    03-22 14:47:12.968 2532-2532/com.owncloud.android I/CreateView﹕ 5 null
    03-22 14:47:12.995 2532-2551/com.owncloud.android D/RefreshFolderOperation﹕ Checking changes
    03-22 14:47:13.001 2532-2532/com.owncloud.android I/CreateView﹕ 6 null
    03-22 14:47:13.051 2532-2551/com.owncloud.android W/System.err﹕ SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    03-22 14:47:13.051 2532-2551/com.owncloud.android W/System.err﹕ SLF4J: Defaulting to no-operation (NOP) logger implementation
    03-22 14:47:13.051 2532-2551/com.owncloud.android W/System.err﹕ SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    03-22 14:47:13.125 2532-2544/com.owncloud.android W/art﹕ Suspending all threads took: 24.846ms
    03-22 14:47:13.129 2532-2544/com.owncloud.android I/art﹕ Background sticky concurrent mark sweep GC freed 2291(163KB) AllocSpace objects, 2(32KB) LOS objects, 9% free, 2MB/2MB, paused 26.706ms total 73.139ms
    03-22 14:47:13.172 2532-2532/com.owncloud.android I/CreateView﹕ 7 null
    03-22 14:47:13.175 2532-2532/com.owncloud.android D/FileActivity﹕ Operations service connected
    03-22 14:47:13.177 2532-2532/com.owncloud.android D/FileDisplayActivity﹕ Download service connected
    03-22 14:47:13.235 2532-2544/com.owncloud.android I/art﹕ Background partial concurrent mark sweep GC freed 1711(168KB) AllocSpace objects, 5(80KB) LOS objects, 24% free, 2MB/3MB, paused 1.615ms total 103.267ms
    03-22 14:47:13.252 2532-2532/com.owncloud.android D/FileDisplayActivity﹕ Upload service connected
    03-22 14:47:13.274 2532-2532/com.owncloud.android I/Choreographer﹕ Skipped 133 frames! The application may be doing too much work on its main thread.
    03-22 14:47:13.274 2532-2532/com.owncloud.android I/CreateView﹕ 0 android.widget.LinearLayout{3018bbda V.E..... ......ID 0,0-480,86 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:13.277 2532-2532/com.owncloud.android I/CreateView﹕ 1 android.widget.LinearLayout{2860980b V.E..... ......ID 0,87-480,173 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:13.317 2532-2551/com.owncloud.android D/OwnCloudClient #0﹕ REQUEST PROPFIND /remote.php/webdav/
    03-22 14:47:13.367 2532-2532/com.owncloud.android I/CreateView﹕ 2 android.widget.LinearLayout{2f646e8 V.E..... ......ID 0,174-480,260 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:13.370 2532-2532/com.owncloud.android I/CreateView﹕ 3 android.widget.LinearLayout{be71101 V.E..... ......ID 0,261-480,347 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:13.374 2532-2532/com.owncloud.android I/CreateView﹕ 4 android.widget.LinearLayout{2056bba6 V.E..... ......ID 0,348-480,434 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:13.376 2532-2532/com.owncloud.android I/CreateView﹕ 5 android.widget.LinearLayout{3a7ea9e7 V.E..... ......ID 0,435-480,521 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:13.417 2532-2532/com.owncloud.android I/CreateView﹕ 6 android.widget.LinearLayout{1632bc3d V.E..... ......ID 0,522-480,608 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:13.432 2532-2532/com.owncloud.android I/CreateView﹕ 7 android.widget.LinearLayout{3d22ec32 V.E..... ......ID 0,609-480,695 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:13.436 2532-2532/com.owncloud.android D/gralloc_goldfish﹕ Emulator without GPU emulation detected.
    03-22 14:47:13.705 2532-2551/com.owncloud.android D/RefreshFolderOperation﹕ Send broadcast com.owncloud.android.operations.RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED
    03-22 14:47:13.726 2532-2551/com.owncloud.android D/OwnCloudClient #0﹕ REQUEST GET /ocs/v1.php/apps/files_sharing/api/v1/shares
    03-22 14:47:13.834 2532-2551/com.owncloud.android D/GetRemoteSharesForFileOperation﹕ Got 0 shares
    03-22 14:47:13.844 2532-2551/com.owncloud.android D/FileDataStorageManager﹕ Sending 23 operations to FileContentProvider
    03-22 14:47:13.891 2532-2551/com.owncloud.android D/FileContentProvider﹕ applying batch in provider com.owncloud.android.providers.FileContentProvider@31225b8c (temporary: false)
    03-22 14:47:13.952 2532-2551/com.owncloud.android D/FileContentProvider﹕ applied batch in provider com.owncloud.android.providers.FileContentProvider@31225b8c
    03-22 14:47:13.954 2532-2551/com.owncloud.android D/RefreshFolderOperation﹕ Send broadcast com.owncloud.android.operations.RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED
    03-22 14:47:13.968 2532-2532/com.owncloud.android I/Choreographer﹕ Skipped 99 frames! The application may be doing too much work on its main thread.
    03-22 14:47:14.002 2532-2532/com.owncloud.android D/FileDisplayActivity﹕ Received broadcast com.owncloud.android.operations.RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED
    03-22 14:47:14.023 2532-2532/com.owncloud.android D/FileDisplayActivity﹕ Setting progress visibility to true
    03-22 14:47:14.027 2532-2532/com.owncloud.android D/FileDisplayActivity﹕ Received broadcast com.owncloud.android.operations.RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED
    03-22 14:47:14.057 2532-2532/com.owncloud.android D/FileDisplayActivity﹕ Setting progress visibility to false
    03-22 14:47:14.060 2532-2532/com.owncloud.android I/CreateView﹕ 0 android.widget.LinearLayout{2057ecf9 V.E..... ......I. 0,0-480,86 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:14.074 2532-2532/com.owncloud.android I/CreateView﹕ 1 android.widget.LinearLayout{cca8fec V.E..... ......I. 0,87-480,173 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:14.076 2532-2532/com.owncloud.android I/CreateView﹕ 2 android.widget.LinearLayout{26a15fb5 V.E..... ......I. 0,174-480,260 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:14.078 2532-2532/com.owncloud.android I/CreateView﹕ 3 android.widget.LinearLayout{18dd164a V.E..... ......I. 0,261-480,347 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:14.081 2532-2532/com.owncloud.android I/CreateView﹕ 4 android.widget.LinearLayout{3a2939bb V.E..... ......I. 0,348-480,434 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:14.085 2532-2532/com.owncloud.android I/CreateView﹕ 5 android.widget.LinearLayout{34c6bed8 V.E..... ......I. 0,435-480,521 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:14.087 2532-2532/com.owncloud.android I/CreateView﹕ 6 android.widget.LinearLayout{39d54231 V.E..... ......I. 0,522-480,608 #7f0a0068 app:id/ListItemLayout}
    03-22 14:47:14.089 2532-2532/com.owncloud.android I/CreateView﹕ 7 android.widget.LinearLayout{3cde4d16 V.E..... ......I. 0,609-480,695 #7f0a0068 app:id/ListItemLayout}

    Search for CreateView in log. That is Info log at the beginning of getView in FileListListAdapter. And above is a log from application start. I don't know but getView gets called 3 times for each View.

  9. inducer commented on Apr 10, 2015

    @inducer

    Perhaps the worst aspect of this is that file names are no longer shown, and so picking a file is next to impossible. And I have not yet found how to revert to the plain list view.

    screenshot_2015-04-09-22-16-24

  10. Spacefish commented on Apr 12, 2015

    @Spacefish

    I digged into this and implemented L1 and L2 as @Skymania proposed as well (a simple HashMap in DiskLruImageCache.getBitmap(String key)).
    However the far more problematic thing here: Bitmaps created in this function are assigned to ImageViews in the scrollable List of Elements. But they are NEVER! recycled! The ImageView does not recycle the Bitmap as it can´t be sure, that there isn´t any reference to that Bitmap left! This leads to a memory leak and will crash the Android application in the long run.

    I didn´t come up with a solution this far. As the Bitmap might be used somewhere else, so just doing .recycle() in the ImageViews onDestroy would create other problems.. We need active reference counting / memory tracking for these bitmap objects as they clog up the memory real fast otherwise.

  11. masensio commented on May 7, 2015

    @masensio

    Hi @mbiebl,

    We are working to improve the thumbnails behaviour.
    To know if our changes solves this problem, we need a description of this bug, to reproduce it in our tests.
    Could you please describe your problem specifying: device, Android version, app version, server version and the steps to reproduce it? Please indicate also the number of files (aprox) that you have in the folder.
    You can use the template https://github.com/owncloud/android/blob/master/issue_template.md

  12. cdhowie commented on May 26, 2015

    @cdhowie

    I don't know if this is related to thumbnail loading behavior, but when loading thumbnails for a large folder and I tap on a picture, the picture is downloaded nearly immediately but it will not display until the thumbnails in the folder are fully loaded, almost as if there is a queue of operations being performed that includes the thumbnail fetches, and displaying the picture I just download gets added to the back of the queue.

    This could be a separate issue, but I have a very strong gut feeling that they are related somehow. If I tap an image to view it, displaying that image should take priority over anything else the app is doing.

  13. jab416171 commented on Jun 29, 2015

    @jab416171

    @masensio, does this help?

    Expected behaviour

    Thumbnails for images should load quickly. Maybe something that runs in the background would help here.

    Filenames would also be helpful.

    Actual behaviour

    Thumbnails take forever to load (About one second per image).

    Steps to reproduce

    1. Upload a bunch of images to ownCloud
    2. Open the app, and browse to the folder with the images.

    Environment data

    Android version: 5.1.1

    Device model: Nexus 6

    Stock or customized system: Stock

    ownCloud app version: 1.7.1

    ownCloud server version: 8

  14. tobiasKaminsky commented on Jun 29, 2015

    @tobiasKaminsky
    Contributor

    The main problem is that currently the generated previews are png and therefore really big compared to jpg.
    I have opened an issue in core: owncloud/core#12008

  15. masensio commented on Jun 30, 2015

    @masensio

    Hi @jab416171,

    thanks for your description.
    We have made some improvements in the thumbnails loading process. These will be available in the next release of the app (1.7.2) .
    The new version will be available in the next days.

    We have tested the improvements with a folder which contains more than 1000 files, but every feedback about this feature is welcome.
    When it will be available, could you test this issue and tell us if the app runs better in this way?

    Thanks.

  16. jab416171 commented on Jun 30, 2015

    @jab416171

    @masensio Yup, I plan on testing out thumbnails on the new version. Do you think it'll be out by Friday?

  17. ddijak commented on Apr 25, 2016

    @ddijak

    What would be a potential problem for using already writen and tested image loading library? There a couple of good ones out there. UIL, Picasso, Glide, etc. Is it a licence problem?

  18. AndyScherzinger commented on Apr 25, 2016

    @AndyScherzinger
    Contributor

    It is not a license problem per se as long as the license is compatible but rather a general rule of thumb to only use libraries when (absolutely) necessary to keep external dependencies at a minimun to be the master of the complete code base.
    The only libs used so far are Google's support libs, the FAB with speed dial, caching, webdav, etc. and (for now) the apache http lib.

    So generally speaking using a lib is possible and always up for discussion with the core team.

  19. tobiasKaminsky commented on Apr 29, 2016

    @tobiasKaminsky
    Contributor

    @LukeOwncloud I think this as not so easy possible as currently the thumbnail creation is done by the async task which is executed per each imageView (icon).
    Getting more thumbnails at once will only be possible when we have an option "download all thumbnails/resized images".

  20. davivel commented on Aug 16, 2016

    @davivel
    Contributor

    Is this still a problem?

    There are things here that have not been addressed yet, but I remember of a couple of bugs that were fixed in the last year that should have helped here.

  21. cdhowie commented on Aug 23, 2016

    @cdhowie

    @davivel The situation is definitely better. There's still some sluggishness around folders with thousands of pictures, but I think the bottleneck is now elsewhere. (It could also be better in part because I upgraded my server from an old single-core Dell desktop to a brand new quad-core HP server. 😉)

  22. davivel commented on Aug 26, 2016

    @davivel
    Contributor

    @cdhowie , thanks a lot for your feedback :)

    I remember fixing some problem with threads getting locked that was affecting the thumbnails, among other things, though I'm not sure if the timing of the fix matches the evolution of this issue.

    With this answer, I'd dare to close this issue. If anybody consider it still broken, please, just add a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions