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

version 2.0.3-beta uses too much memory and is often killed by Android #156

Open
tanty opened this issue May 10, 2023 · 13 comments
Open

version 2.0.3-beta uses too much memory and is often killed by Android #156

tanty opened this issue May 10, 2023 · 13 comments
Labels
bug Something isn't working

Comments

@tanty
Copy link

tanty commented May 10, 2023

This is not new from this version. Has been happening for quite a while.

  • I open the app.
  • It logins correctly and shows me the list of albums.
  • I get into an album.
  • The application closes itself unexpectedly.
@tanty tanty changed the title version 2.0.3-beta crashes when opening large albums version 2.0.3-beta crashes when opening albums May 10, 2023
@remi-martin remi-martin added the bug Something isn't working label May 10, 2023
@remi-martin
Copy link
Collaborator

Hi, that sound strange. Did it worked properly before ? How many files are in the albums and what's their file type (jpg, png, heic, mp4, ...) ? In the app settings, what's the thumbnail size (medium, large, ...) ?

Also, can you give me more information about the device ?

That will help me to understand and maybe reproduce the issue...

@tanty
Copy link
Author

tanty commented May 23, 2023

Hi, that sound strange. Did it worked properly before ?

In my experience, the application has never worked very well. Before it may load an album but take very long time on getting the thumbnails and be able to scroll. Others, it just crashed.

How many files are in the albums and what's their file type (jpg, png, heic, mp4, ...) ?

It varies a lot. From tens to thousands.

I can reproduce with any album so, let's say, just a bunch of pictures (8?) and all of them JPEGs.

In the app settings, what's the thumbnail size (medium, large, ...) ?

Medium.

Also, can you give me more information about the device ?

That will help me to understand and maybe reproduce the issue...

Sony Xperia zx2c running LineageOS 19-20220902-NIGHTLY-xz2c

Is there any way I can get any debug information or logs from the app?

@tanty
Copy link
Author

tanty commented May 23, 2023

And just now, the application also crashed just by opening, going to the settings and clicking to the back arrow ...

@remi-martin
Copy link
Collaborator

I think this is related to the image cache.
In order to find a solution I might need an access to your Piwigo (just as a guest), so I can try to reproduce it and locate the error.

@tanty
Copy link
Author

tanty commented May 24, 2023

My gallery is publicly available at: https://gallery.andresgomez.org/

If you need to log in with the minimal privileges, let me know how can I send you the credentials through a private channel.

@remi-martin
Copy link
Collaborator

Ok so I am abled to access your Piwigo but the app doesn't crash when I open the albums.

Maybe try to empty the cache from the app settings, or just reinstall it.

@tanty
Copy link
Author

tanty commented May 25, 2023

I've emptied the cache: same result.

I've reinstalled the application: same result.

Is there any way of getting logs or backtraces from the app?

@tanty
Copy link
Author

tanty commented May 25, 2023

BTW, by now I'm using 2.0.4

@remi-martin
Copy link
Collaborator

Which version of Android you are running ?

Sadly I don't know how to get the logs on a Flutter application like Piwigo NG.

@tanty
Copy link
Author

tanty commented May 25, 2023

Which version of Android you are running ?

Sony Xperia zx2c running LineageOS 19-20220902-NIGHTLY-xz2c

https://wiki.lineageos.org/devices/xz2c/

LineageOS 19 is based on Android 12L

Sadly I don't know how to get the logs on a Flutter application like Piwigo NG.

This may be a priority to be able to use a beta application. If it is beta and for users evaluation it looks critical to me that there should be a way of getting some logging information or, at least, be able to catch a crash stack trace.

@tanty
Copy link
Author

tanty commented May 25, 2023

So, after a quick session with adb logcat the problem seems to be that the application is not crashing but rather being killed by Android's lowMemoryKiller (which also kills plenty of other apps at the same time than killing Piwigo NG):

`
05-25 16:20:36.840 0 0 I lowmemorykiller: Killing 'iwigo.piwigo_ng' (32188), adj 0,
05-25 16:20:36.840 0 0 I : to free 1722272kB on behalf of 'UsbFfs-worker' (31715) because
05-25 16:20:36.840 0 0 I : cache 29712kB is below limit 73728kB for oom_score_adj 0
05-25 16:20:36.840 0 0 I : Free memory is -4392kB above reserved.
05-25 16:20:36.840 0 0 I : Free CMA is 668kB
05-25 16:20:36.840 0 0 I : Total reserve is 45728kB
05-25 16:20:36.840 0 0 I : Total free pages is 17972kB
05-25 16:20:36.840 0 0 I : Total file cache is 251876kB
05-25 16:20:36.840 0 0 I : Slab Reclaimable is 62696kB
05-25 16:20:36.840 0 0 I : Slab UnReclaimable is 252012kB
05-25 16:20:36.840 0 0 I : Total Slab is 314708kB
05-25 16:20:36.840 0 0 I : GFP mask is 0x24040c0
05-25 16:20:36.840 0 0 I : Indirect Reclaimable is 0kB
05-25 16:20:36.840 0 0 I : Free Swap 11292kB
05-25 16:20:36.840 0 0 I : queue len is 1 of max 1 reason:0x2 margin:-3548
05-25 16:20:36.840 0 0 I : psi full is 0 psi some is 0

[...]

05-25 16:20:36.925 0 0 I oom_reaper: reaped process 32188 (iwigo.piwigo_ng), now anon-rss:0kB, file-rss:1074336kB, shmem-rss:252kB
`

Also, you can see plenty of these warnings:

05-25 16:29:42.730 5874 5904 I flutter : Warning database has been locked for 0:00:10.000000. Make sure you always use the transaction object for database operations during a transaction

So, other than my phone could have more RAM (4G), often "only" ~700M free, it seems that the Piwigo NG app is not really handling well the amount of used memory. Probably, loading everything even if it is not visible to the user.

The oom killer only happens with this application. I don't usually see this happening.

@tanty tanty changed the title version 2.0.3-beta crashes when opening albums version 2.0.3-beta uses too much memory and is often killed by Android May 25, 2023
@remi-martin
Copy link
Collaborator

Hi, this is because the app shows a lot of images and so I added a cache for that. The problem is that it is still taking too much memory on certain devices. I have made some small changes about this but it is hard for me to tell if it will be efficient.

@remi-martin
Copy link
Collaborator

I've made some changes to image display and cache for version 2.2.0.

Please feel free to try it out and see if it solves the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants