signalapp / Signal-Android

A private messenger for Android.
https://signal.org
GNU Affero General Public License v3.0
25.66k stars 6.16k forks source link

Crash on opening the gallery #10624

Closed pr0gg3r closed 2 years ago

pr0gg3r commented 3 years ago

Bug description

Crash on opening the gallery (I already reinstalled Signal, this did not solve the problem).

Steps to reproduce

Actual result: I see the gallery for a second, than it crashs and is closed. Expected result: Gallery opens and stays open so I can select a photo.

Screenshots

A6p3wZn3ev crc0jF1gw6 O5CXBvOGol ZvvzQ75a1x

Device info

Device: HUAWEI P30 Pro (VOG-L29) Android version: 10.1.0 Signal version: 5.1.8

Link to debug log

via profile photo selection https://debuglogs.org/d2c47b458026560637732ce1e61fe6e38034c6899edc4334f0f756545df1796f

via group photo selection https://debuglogs.org/e86b1008a06620a98492254cddfe7291992a380f121668a749f5d669344fa26c

via attach photo to message https://debuglogs.org/f693bdfbba6a4f88a4bef23c01721042060280a9c9fb0a755e359e0b412e6c77

via camera screen https://debuglogs.org/535a9063eaf40743082a8db9e6994f50261d614cb82220adc3996620e900997f

pr0gg3r commented 3 years ago

After several hours of investigation, I found a workaround for this bug. I started with cleaning up my device. I deleted a huge number of different folders with old images. I even have uninstalled Google Photos. Nothing helped. Then I tried to take a screenshot of the gallery to see after which thumbnail the crash happens. And indeed, I could identify a folder without a thumbnail. I found this folder with the Solid Explorer App. There was just a single file in this folder. It was a short video I have created with a free video editor. I don't remember the name of that editor. Furthermore, the video file was not broken, I could play it without any problem. However, as a last act of desperation I have deleted this file and... the gallery does not crash anymore. I'm glad I found a workaround, but please fix this bug. I had to sacrifice several gigabytes of photos and videos to find this solution.

3fd

platypusgit commented 3 years ago

Could you provide more information about the file and how you located it by taking a screenshot? Thank you for your sacrifices!

pr0gg3r commented 3 years ago

Video was 1440p, 31sec long - that is sure, because I uploaded it to YouTube and have checked that now. But I am not 100% about the original file type, I think it was mp4.

Locating it was a little tricky. The gallery activity opens and is visible for a fraction of a second. I took many dozens of screenshots and then I realized that every folder preview image is loaded one after the other. So, I tried to find out which preview/thumbnail is not present. Of course, I could not scroll because of the short time so I had to delete the folders which worked well (existing preview) to see the next bunch of folders.

Here is an example of a screenshot taken to early:

sNEBzUvFR0

Here one just in time before its crash:

3XxGTrrMeW

Folder 1 and 2 have no preview. So I searched for folder 1 in Solid Explorer, found it, deleted the content, restarted Signal and it did not crash anymore.

platypusgit commented 3 years ago

Thank you so much! I'll try your workaround in the next few days.

JekRock commented 3 years ago

Experience the same issue. Here is my debug log

g42d commented 3 years ago

I have the same problem. I will try the workaround

g42d commented 3 years ago

I found the culprit. In my case, there was a folder without the thumbnail called ADM. It was generated by the app Advanced Download Manager. I deleted both the folder and the app and now it works

JekRock commented 3 years ago

I think I've found the source of the issue. Here is what happens in the log when the gallery preview from the camera is being closed:

2021-01-17 18:07:22.304 18429-18429/org.thoughtcrime.securesms I/ViewRootImpl: jank_removeInvalidNode all the node in jank list is out of time
2021-01-17 18:07:22.314 18429-18429/org.thoughtcrime.securesms D/StreamStateObserver: Update Preview stream state to IDLE
2021-01-17 18:07:22.614 18429-18519/org.thoughtcrime.securesms D/skia: --- Failed to create image decoder with message 'unimplemented'
2021-01-17 18:07:22.616 18429-18519/org.thoughtcrime.securesms D/skia: --- Failed to create image decoder with message 'unimplemented'
2021-01-17 18:07:22.617 18429-18519/org.thoughtcrime.securesms I/chatty: uid=10253(org.thoughtcrime.securesms) glide-source-th identical 1 line
2021-01-17 18:07:22.619 18429-18519/org.thoughtcrime.securesms D/skia: --- Failed to create image decoder with message 'unimplemented'
2021-01-17 18:07:22.626 18429-18650/org.thoughtcrime.securesms W/ExifInterface: Skip the tag entry since tag number is not defined: 2
2021-01-17 18:07:22.626 18429-18650/org.thoughtcrime.securesms W/ExifInterface: Stop reading file since a wrong offset may cause an infinite loop: 0
2021-01-17 18:07:22.626 18429-18650/org.thoughtcrime.securesms W/ExifInterface: Stop reading file since a wrong offset may cause an infinite loop: 0
2021-01-17 18:07:22.627 18429-18650/org.thoughtcrime.securesms W/ExifInterface: Skip the tag entry since data format (URATIONAL) is unexpected for tag: GPSAltitudeRef
2021-01-17 18:07:22.628 18429-18650/org.thoughtcrime.securesms W/ExifInterface: Stop reading file since a wrong offset may cause an infinite loop: 0
2021-01-17 18:07:22.629 18429-18650/org.thoughtcrime.securesms W/ExifInterface: Stop reading file since a wrong offset may cause an infinite loop: 0
2021-01-17 18:07:22.640 18429-18519/org.thoughtcrime.securesms V/BitmapFactoryEx: nativeDecodeFileDescriptorEx
2021-01-17 18:07:22.641 18429-18519/org.thoughtcrime.securesms A/libc: FORTIFY: read: count 18446744072793573601 > SSIZE_MAX
2021-01-17 18:07:22.641 18429-18519/org.thoughtcrime.securesms A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 18519 (glide-source-th), pid 18429 (crime.securesms)
2021-01-17 18:07:22.659 18429-18429/org.thoughtcrime.securesms W/glide-source-th: type=1400 audit(0.0:4372634): avc: granted { read } for path="/mnt/media_rw/C0EA-72C2/DCIM/Camera/IMG_20210113_1234.jpg" dev="mmcblk1p1" ino=16264767 scontext=u:r:untrusted_app:s0:c253,c256,c512,c768 tcontext=u:object_r:exfat:s0 tclass=file
2021-01-17 18:07:22.671 18429-18442/org.thoughtcrime.securesms I/CameraDevice-JV-1: Camera now idle
2021-01-17 18:07:22.674 18429-18595/org.thoughtcrime.securesms D/CaptureSession: CameraCaptureSession.onClosed()
2021-01-17 18:07:22.677 18429-18595/org.thoughtcrime.securesms D/DeferrableSurface: use count-1,  useCount=0 closed=true androidx.camera.core.impl.ImmediateSurface@4511002
2021-01-17 18:07:22.677 18429-18595/org.thoughtcrime.securesms D/DeferrableSurface: Surface no longer in use[total_surfaces=3, used_surfaces=2](androidx.camera.core.impl.ImmediateSurface@4511002}
2021-01-17 18:07:22.678 18429-18595/org.thoughtcrime.securesms D/DeferrableSurface: Surface terminated[total_surfaces=2, used_surfaces=2](androidx.camera.core.impl.ImmediateSurface@4511002}
2021-01-17 18:07:22.678 18429-18595/org.thoughtcrime.securesms D/DeferrableSurface: use count-1,  useCount=0 closed=true androidx.camera.core.impl.ImmediateSurface@8ff7077
2021-01-17 18:07:22.679 18429-18595/org.thoughtcrime.securesms D/DeferrableSurface: Surface no longer in use[total_surfaces=2, used_surfaces=1](androidx.camera.core.impl.ImmediateSurface@8ff7077}
2021-01-17 18:07:22.679 18429-18595/org.thoughtcrime.securesms D/DeferrableSurface: Surface terminated[total_surfaces=1, used_surfaces=1](androidx.camera.core.impl.ImmediateSurface@8ff7077}
2021-01-17 18:07:22.679 18429-18595/org.thoughtcrime.securesms D/DeferrableSurface: use count-1,  useCount=0 closed=true androidx.camera.core.SurfaceRequest$2@2c42a4e
2021-01-17 18:07:22.680 18429-18595/org.thoughtcrime.securesms D/DeferrableSurface: Surface no longer in use[total_surfaces=1, used_surfaces=0](androidx.camera.core.SurfaceRequest$2@2c42a4e}
2021-01-17 18:07:22.680 18429-18595/org.thoughtcrime.securesms D/DeferrableSurface: Surface terminated[total_surfaces=0, used_surfaces=0](androidx.camera.core.SurfaceRequest$2@2c42a4e}
2021-01-17 18:07:22.681 18429-18595/org.thoughtcrime.securesms I/CameraDevice-JV-1: close camera: 1, package name: org.thoughtcrime.securesms
2021-01-17 18:07:22.681 18429-18595/org.thoughtcrime.securesms I/BackgroundPermManager: pkgName: org.thoughtcrime.securesms,pid: 18429 ,uidOf3RdApk: 10253 ,permType: 0 ,permCfg: 0
2021-01-17 18:07:22.684 18429-18595/org.thoughtcrime.securesms I/HwCameraUtil: notifySurfaceFlingerCameraStatus : isFront = true , isOpend = false
2021-01-17 18:07:22.686 18429-18595/org.thoughtcrime.securesms I/HwCameraUtil: notifySurfaceFlingerFrontCameraStatus 8012 transact success!
2021-01-17 18:07:22.695 18429-18429/org.thoughtcrime.securesms D/SurfaceViewImpl: Safe to release surface.
2021-01-17 18:07:22.699 18429-18429/org.thoughtcrime.securesms W/glide-source-th: type=1400 audit(0.0:4372643): avc: granted { read } for path="/mnt/media_rw/C0EA-72C2/DCIM/Camera/IMG_123.jpg" dev="mmcblk1p1" ino=16264767 scontext=u:r:untrusted_app:s0:c253,c256,c512,c768 tcontext=u:object_r:exfat:s0 tclass=file
2021-01-17 18:07:22.794 18429-18595/org.thoughtcrime.securesms D/CaptureSession: CameraCaptureSession.onReady() RELEASED
2021-01-17 18:07:22.796 18429-18595/org.thoughtcrime.securesms D/Camera2CameraImpl: {Camera@69c9d60[id=1]} CameraDevice.onClosed()
2021-01-17 18:07:22.798 18429-18595/org.thoughtcrime.securesms D/Camera2CameraImpl: {Camera@69c9d60[id=1]} Transitioning camera internal state: CLOSING --> INITIALIZED
2021-01-17 18:07:22.804 18429-18595/org.thoughtcrime.securesms D/CameraStateRegistry: Recalculating open cameras:
    Camera                                       State                 
    -------------------------------------------------------------------
    Camera@c8dca65[id=0]                         UNKNOWN               
    Camera@69c9d60[id=1]                         CLOSED                
    -------------------------------------------------------------------
    Open count: 0 (Max allowed: 1)

The most interesting part of the log is:

2021-01-17 18:07:22.641 18429-18519/org.thoughtcrime.securesms A/libc: FORTIFY: read: count 18446744072793573601 > SSIZE_MAX
2021-01-17 18:07:22.641 18429-18519/org.thoughtcrime.securesms A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 18519 (glide-source-th), pid 18429 (crime.securesms)

Fast googling gave me that issue from the Glide library that is used in the Signal app for loading images including camera gallery previews. According to the discussion in that issue, the error appears in the Glide v4.11on Huawei devices while v4.10 doesn't have this problem. The Signal app is using Glide v4.11(link). So, the solution might be a fallback to the Glide v4.10

JekRock commented 3 years ago

@pr0gg3r @g42d do you have a Huawei device? I have a Huawei device, but I don't have another one to check whether the issue appears on non-Huawei devices

g42d commented 3 years ago

@pr0gg3r @g42d do you have a Huawei device? I have a Huawei device, but I don't have another one to check whether the issue appears on non-Huawei devices

In my case, it's a Huawei P30 Pro Device info: HUAWEI VOG-L29 (VOG-L29EEA) Android version: 10 (10.1.0.150C431, VOG-L29 10.1.0.150(C431E19R2P5)) Signal version: 5.1.9 Signal package: org.thoughtcrime.securesms Registration lock: false Locale: en_DE

JekRock commented 3 years ago

I've just checked the current Signal version with the previous Glide version that had been used before (v4.9.0) and the gallery preview works without any errors. @greyson-signal I've seen that you updated the Glide version at d05a71c8fe. Is it possible to fall back to Glide v4.9.0 to resolve the gallery issue until it's fixed in Glide?

richardddd98 commented 3 years ago

I think I have this problem too. If I have at least one long screen recording (more than 3 GiB), when I scroll the gallery and Signal attempts to show its thumbnail it crashes and asks me again to unlock it with my fingerprint. My device is Huawei P40 Lite 5G

DarkoVeberic commented 3 years ago

Duplicate of #10394

stale[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

JekRock commented 2 years ago

I'll try to reproduce it again on the same phone. I don't see glide in dependencies anymore, though.

stale[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] commented 2 years ago

This issue has been closed due to inactivity.