ubports / camera-app

Moved to GitLab
https://gitlab.com/ubports/apps/camera-app
GNU General Public License v3.0
10 stars 9 forks source link

media info makes phone freeze or crashes camera app [vegetahd] #118

Open Danfro opened 6 years ago

Danfro commented 6 years ago

Steps to reproduce

  1. start camera app
  2. take picture if none is already available
  3. goto photo roll (swipe)
  4. open menu on top right corner
  5. tap on Image Info Image info is shown. Great so far! :-) But height and width are given with the value 0.
  6. wait a couple of seconds then either
    • camera app gets closed/crashes
    • phone freezes
    • the ubuntu screen comes on and I have to log on again

I tried it several times now. It seems to me that extracting the image size does take a few seconds. At that point when the values are taken sometimes it actually extracts/shows height and width correctly :-) or crashes. :-(

Expected behavior

  1. no crash/freeze expected
  2. height and width given with the correct values
  3. Image info placed a bit lower so it is entirely readable

Logfiles and additional information

screenshot showing the zero values photo for testing screenshot20181010_220108175 image20181010_181524417

dark-eye commented 6 years ago

@Danfro Thanks for reporting! :+1:

I`ll try and recreate it do you have a type of images it happen the most on?

Danfro commented 6 years ago

I am only running ubuntu touch on my phone. No other devices or images I am afraid.

Danfro commented 6 years ago

Stupid me ;-). Thinking of system images, not of photo=images. I tried 3 or 4 photos yesterday with the same result.

I tried several resolutions today. With small images I do get the size data more or less without delay - and without crashes. My example image and the other ones I had this issue with yesterday are full quality and highest resolution. The app crashes more or less only if the height and width information can not be extracted. The large the file the longer the delay before height and width values are shown. Even with the large files there where very few occasions when I did get height and width shown and no crash. The app crashing happens most of the time. System freeze only once so far, the log off only very rarely.

So it might be a memory thing depending on the size of the image.

dark-eye commented 6 years ago

Hmm yeah that sound like either a memory issue or some race condition issue , btw did the unity UI freeze or just the camera app ?

Danfro commented 6 years ago

Btw. is there a specific reason why the option image info is not available at the gallery as well?

Most of the time the camera app crashes = the app closes down. Everything else keeps working. Twice the whole UI freezed. I had to press and hold the power button to get my phone responding at all. Twice the screen showed the ubuntu screen with those dots and I had to log in again.

dark-eye commented 6 years ago

Hmm I`ll try an replicate it on my Meizu PRO

UniversalSuperBox commented 5 years ago

Has this become any better with RC 2018-W50? Ref: https://github.com/ubports/ubuntu-touch/issues/965

At some point being out of memory is a hard limit (especially when we only have 1GB), but we can try to make things better.

Danfro commented 5 years ago

Hi Dalton, thanks for reminding me on those issues. ;-) I already did some testing and I really wanted to update them (I promise!), just didn't found the time. Until rc 2018-W48/OTA6 I had only 31 MB swap memory. I am sure that was also the reason for #915 . I already tried applying zram before the last update. This resulting in 511 MB of swap memory. Yes it does make it better, but no I can not call it solved. :-( I just did a new test with rc 2018-W50. Reboot phone to make sure I start from scratch. free -h >>Documents/mem.txt does provide the available memory. Photos are highest quality and resolution.

Test one [see mem1.txt]: open terminal app open camera app as well do image info of 1st photo do image info of 2nd photo do image info of 3nd photo terminal app freezes for a few seconds, then asks for password again do image info of 4th photo do image info of 5th photo do image info of 6th photo mem1.txt

Test 2 using only free -h and taking screenshots from terminal app open terminal app (free -h, screenshot) open fluffychat (free -h, screenshot) open camera app as well (free -h, screenshot) do image info of 1st photo (free -h, screenshot) do image info of 2nd photo (free -h, screenshot) camera app crashes!!!

As you can see image info is using a lot of memory. If you open other apps and do not print free -h to a file but take screenshots (so consume more memory) the camera app crashes. Therefore I would like to keep this issue open.

UniversalSuperBox commented 5 years ago

Since this is specific to the camera app (the operation which takes a lot of memory), I've moved this issue there.

dark-eye commented 5 years ago

@Danfro Thanks for the great info it really helps! It seems that the first instance of querying the image photos take most of the memory and the rest are just incremental changes (Which is a issue by it self as it seems that the high qulaty images doesn't get cleaned once they are off screen...) I`ll try and investigate it now that my meizu is working again...

BTW how did you do the zram trick i want it too :)

Danfro commented 5 years ago

@dark-eye it would be great if you could do some further testing with your device. In rc zram should be activated as default. Otherwise sudo start zram-touch should do the job. Have fun! :-) You will have to do this every time you reboot. It is not persistent on stable channel yet.

dark-eye commented 5 years ago

Hmm it seems thatthe camera app just doesn't wok on my meizu now :/ I`ll have to investigate the reason for it....

dark-eye commented 5 years ago

@Danfro I can't seem to reproduce it in Meizu Pro however here is a possible fix for this issue can you test it and check if the memory leak still exists?

Danfro commented 5 years ago

@dark-eye Thanks for your efforts to solve that issue. I will have to check the memory usage again. I am just a bit busy with food consumption and family parties at the moment :-), so I am not sure how soon I will have time for tests. I will come back then...