immich icon indicating copy to clipboard operation
immich copied to clipboard

Android App Crashes when sliding on a video.

Open carloslockward opened this issue 1 year ago • 33 comments
trafficstars

The bug

Video: https://github.com/immich-app/immich/assets/24941719/1e3bb88f-ecb0-4a1c-91b5-f0084ccc586e

As you can see in the video, Immich crashes as soon as you slide on a video.

The OS that Immich Server is running on

unraid 6.12.9

Version of Immich Server

1.106.4

Version of Immich Mobile App

1.106.3 build.143

Platform with the issue

  • [ ] Server
  • [ ] Web
  • [X] Mobile

Your docker-compose.yml content

N/A

Your .env content

N/A

Reproduction steps

1. Enter app
2. Tap on a video
3. Slide right or left

Relevant log output

No response

Additional information

No relevant logs are produced on the server. Just websocket connect and then disconnect when the crash happens.

carloslockward avatar Jun 17 '24 18:06 carloslockward

Hello, what is your phone model?

alextran1502 avatar Jun 17 '24 18:06 alextran1502

Also any logs can you grab from the mobile app?

alextran1502 avatar Jun 17 '24 18:06 alextran1502

@alextran1502 Is a Samsung S22+. Nothing relevant seems to be happening in the logs.

I set the log level to FINEST, cleared the logs and then reproduced the issue. Here are the logs produced:

2024-06-17 14:44:15.540878 | FINE     | socket_io_client:engine.Socket | flushing 1 packets in socket |
2024-06-17 14:44:15.539720 | FINE     | socket_io_client:engine.Socket | socket receive: type "ping", data "null" |
2024-06-17 14:43:51.747926 | INFO     | AssetNotifier        | Load assets: 1430ms |
2024-06-17 14:43:51.747902 | INFO     | AlbumService         | Syncing completed. Changes: false |
2024-06-17 14:43:51.747890 | FINE     | SyncService          | 0 assets to delete, 0 to update |
2024-06-17 14:43:51.747869 | FINE     | SyncService          | Syncing all local albums almost done. Collected 0 asset candidates to delete |
2024-06-17 14:43:51.747782 | FINE     | SyncService          | Local album Camera has not changed. Skipping sync. |
2024-06-17 14:43:51.709082 | INFO     | AlbumService         | 'Recents' is not selected, keeping only selected albums |
2024-06-17 14:43:51.708979 | INFO     | AlbumService         | Found 54 device albums |
2024-06-17 14:43:50.910340 | INFO     | AlbumService         | Syncing completed. Changes: false |
2024-06-17 14:43:50.910330 | FINE     | SyncService          | 0 assets to delete, 0 to update |
2024-06-17 14:43:50.910317 | FINE     | SyncService          | Syncing all local albums almost done. Collected 0 asset candidates to delete |
2024-06-17 14:43:50.910243 | FINE     | SyncService          | Local album Camera has not changed. Skipping sync. |
2024-06-17 14:43:50.713579 | FINE     | socket_io_client:engine.Socket | socket receive: type "message", data "2["on_new_release",{"isAvailable":false,"checkedAt":"2024-06-17T17:41:56.209Z","serverVersion":{"major":1,"minor":106,"patch":4},"releaseVersion":{"major":1,"minor":106,"patch":4}}]" |
2024-06-17 14:43:50.653247 | FINE     | socket_io_client:engine.Socket | socket receive: type "message", data "2["on_server_version",{"options":{},"loose":false,"includePrerelease":false,"raw":"1.106.4","major":1,"minor":106,"patch":4,"prerelease":[],"build":[],"version":"1.106.4"}]" |
2024-06-17 14:43:50.644386 | FINE     | socket_io_client:engine.Socket | socket receive: type "message", data "0{"sid":"KzrTxYgt647ZBWafAABZ"}" |
2024-06-17 14:43:50.606617 | INFO     | AlbumService         | 'Recents' is not selected, keeping only selected albums |
2024-06-17 14:43:50.596675 | INFO     | AlbumService         | Found 54 device albums |
2024-06-17 14:43:50.548669 | FINE     | socket_io_client:engine.Socket | flushing 1 packets in socket |
2024-06-17 14:43:50.548657 | FINE     | socket_io:parser.Encoder | encoded {type: 0, data: null, nsp: /} as 0 |
2024-06-17 14:43:50.548623 | FINE     | socket_io:parser.Encoder | encoding packet {type: 0, data: null, nsp: /} |
2024-06-17 14:43:50.548614 | FINE     | socket_io_client:Manager | writing packet {type: 0, data: null, nsp: /} |
2024-06-17 14:43:50.548599 | FINE     | socket_io_client:Socket | transport is open - connecting |
2024-06-17 14:43:50.548498 | FINE     | socket_io_client:Manager | cleanup |
2024-06-17 14:43:50.548490 | FINE     | socket_io_client:Manager | open |
2024-06-17 14:43:50.548478 | FINE     | socket_io_client:engine.Socket | socket open |
2024-06-17 14:43:50.548412 | FINE     | socket_io_client:engine.Socket | socket receive: type "open", data "{"sid":"oXtyEqtojXDT0yDnAABY","upgrades":[],"pingInterval":25000,"pingTimeout":20000,"maxPayload":1000000}" |
2024-06-17 14:43:50.293210 | FINE     | socket_io_client:Manager | readyState opening |
2024-06-17 14:43:50.293083 | FINE     | socket_io_client:Manager | connect attempt will timeout after 20000 |
2024-06-17 14:43:50.292884 | FINE     | socket_io_client:engine.Socket | setting transport websocket |
2024-06-17 14:43:50.291578 | FINE     | socket_io_client:engine.Socket | creating transport "websocket" |
2024-06-17 14:43:50.291366 | FINE     | socket_io_client:Manager | opening REDACTED |
2024-06-17 14:43:50.291284 | FINE     | socket_io_client:Manager | readyState closed |
2024-06-17 14:43:50.291104 | FINE     | socket_io_client     | ignoring socket cache for REDACTED |
2024-06-17 14:43:49.415561 | INFO     | ApiService           | Pinging server with response code 200 |

carloslockward avatar Jun 17 '24 18:06 carloslockward

Thank you, does it crash on every video or just that one specific video?

alextran1502 avatar Jun 17 '24 20:06 alextran1502

Also happens on my Pixel 7 Android 14.

Only happens while switching from one video to another for me. But every time.

https://github.com/immich-app/immich/assets/833191/fe6ccfbd-786b-4dba-9b45-05641e46ff3d

desmond206x avatar Jun 17 '24 20:06 desmond206x

@alextran1502 I can confirm it only happens when swipping from video to video. I also noticed that this only happens if the videos are on device, if the videos are only on the Immich server it seems it doesnt happen.

carloslockward avatar Jun 17 '24 20:06 carloslockward

I see same bug, Pixel 7* Android 14. When I sliding from one vide file to another (both files are in my phone locally) Immich app is crashing. App version 1.106.4, Server version 1.106.4. Server run in docker at Centos stream 9.

kt368 avatar Jun 19 '24 02:06 kt368

In logcat are you seeing a crash, or is it being lmkd killed? If you're scrolling past a large number of photos/videos prior you're probably running into high memory usage in the android app and it's getting killed swiping like this.

This has been a known issue for me on multiple devices as long as I can remember. Here I can easily hit 6.5-7G app memory usage before it gets killed. As a workaround I only use the app for backups and the website for browsing on android.

RealJohnGalt avatar Jun 24 '24 13:06 RealJohnGalt

If you're scrolling past a large number of photos/videos prior you're probably running into high memory usage in the android app and it's getting killed swiping like this.

No. I can open the app, open the first video of two in a row and after swiping to the second video the app crashes immediately.

desmond206x avatar Jun 24 '24 13:06 desmond206x

If you're scrolling past a large number of photos/videos prior you're probably running into high memory usage in the android app and it's getting killed swiping like this.

No. I can open the app, open the first video of two in a row and after swiping to the second video the app crashes immediately.

I'd still check logcat to see if you get a crash trace or if it is killed. It is very inefficient, so killings occur easily and often.

RealJohnGalt avatar Jun 24 '24 14:06 RealJohnGalt

Any progress on this? It is really annoying to use the app with this bug

desmond206x avatar Jun 30 '24 20:06 desmond206x

There is not. I couldn't reproduce this issue yet on Android phone Samsung S23

alextran1502 avatar Jun 30 '24 20:06 alextran1502

Can you guys go into the app settings > advanced > toggle preferences remote image and see if it fixes the issue?

Also, do you guys access your instance over reverse proxy or local IP? Can it be reproduced on local IP?

alextran1502 avatar Jun 30 '24 20:06 alextran1502

I tried change to "Prefer remote image", but the error still appears.

On Sun, Jun 30, 2024, 13:49 Alex @.***> wrote:

Can you guys go into the app settings > advanced > toggle preferences remote image and see if it fixes the issue?

— Reply to this email directly, view it on GitHub https://github.com/immich-app/immich/issues/10439#issuecomment-2198753233, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4CKW3AUVHCHHSFYDKMH2DZKBVMXAVCNFSM6AAAAABJOQCHAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJYG42TGMRTGM . You are receiving this because you commented.Message ID: @.***>

kt368 avatar Jul 01 '24 01:07 kt368

Yeah, same for me. Still chrashing. Maybe it has something to do with the type of the video? Codec, HDR, ... something like this?

desmond206x avatar Jul 01 '24 05:07 desmond206x

Do you guys have default encoding options? Can you post your encoding settings if you modified them?

alextran1502 avatar Jul 01 '24 06:07 alextran1502

My encoding options have been changed from the default. Here they are: Constant rate factor (-crf) 31 PRESET (-preset) slow AUDIO CODEC aac ACCEPTED AUDIO CODECS AAC MP3 OPUS VIDEO CODEC vp9 ACCEPTED VIDEO CODECS H.264 VP9 TARGET RESOLUTION 720p MAX BITRATE 0 THREADS 0 TRANSCODE POLICY Only videos not in an accepted format TONE-MAPPING Hable TWO-PASS ENCODING Yes Hardware Acceleration disabled Other options default I think this error is not related to video encoding because the error occurs even with the video files which have not yet been converted on the server.

Also here is the properties of one of the source video files: Codec: MPEG AAC Audio (mp4a) Language: English Type: Audio Channels: Stereo Sample rate: 48000 Hz Bits per sample: 32 Stream 1 Codec: MPEG-H Part2/HEVC (H.265) (hvc1) Language: English Type: Video Video resolution: 3840x2160 Buffer dimensions: 3840x2160 Frame rate: 59.695780 Decoded format: Orientation: Left bottom Color primaries: ITU-R BT.709 Color transfer function: ITU-R BT.709 Color space: ITU-R BT.709 Range Chroma location: Left

-- Best Regards Hryhorii

вс, 30 июн. 2024 г. в 23:37, Alex @.***>:

Do you guys have default encoding options? Can you post your encoding settings if you modified them?

— Reply to this email directly, view it on GitHub https://github.com/immich-app/immich/issues/10439#issuecomment-2199351413, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4CKWZKT7SINLQIAPPWTNLZKD2JPAVCNFSM6AAAAABJOQCHAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJZGM2TCNBRGM . You are receiving this because you commented.Message ID: @.***>

kt368 avatar Jul 01 '24 11:07 kt368

I also have this issue. I use the default encoding options.

I am running the latest version of Immich both on my server and the phone.

I got a Nothing Phone 2 with Android 14

https://github.com/immich-app/immich/assets/116492323/f8bbb978-e7d9-4955-ae9f-094497dcba64

RaulGw4 avatar Jul 01 '24 16:07 RaulGw4

There is not. I couldn't reproduce this issue yet on Android phone Samsung S23

Call me on discord, I will give you access to my phone to view what logs you need. raul_gw4

RaulGw4 avatar Jul 01 '24 16:07 RaulGw4

Do you guys have default encoding options? Can you post your encoding settings if you modified them?

I do not use encoding at all. My videos are 80-130mbps h265. I use a reverse proxy but I can recreate on direct local IP also. Here on swiping on videos app memory usage goes crazy and it eventually gets killed (doesn't actually crash). Similar to the memory usage issue from scrolling down photo view in some cases (though that issue seems to be tied to waiting for thumbnails to load, was mostly solved by moving my thumbnails to a nvme).

RealJohnGalt avatar Jul 02 '24 14:07 RealJohnGalt

I wonder if this is related to your video recording settings. Can you share it so that I can reproduce it?

alextran1502 avatar Jul 02 '24 15:07 alextran1502

@RealJohnGalt I also use a reverse proxy and I get the issue. I think the reverse proxy is unrelated.

@alextran1502

To recap:

  • My encoding options are the following:
    • CRF: 23
    • Preset: ultrafast
    • Audio codec: AAC
    • Accepted audio codecs: AAC, MP3, and Opus
    • Video codec: H.264
    • Accepted video codec: H.264
    • Target resolution: 720p
    • Max bitrate: 0
    • Threads: 0
    • Transcode policy: Only not in accepted format
    • Tone mapping: Hable
    • Two-pass encoding: off
    • Hardware acceleration:
      • Acc. API: NVENC (I have an NVIDIA GPU)
      • Hardware decoding: off
      • Constant quality mode: auto
      • Temporal AQ: off
      • Preferred hardware device: auto
    • Advanced:
      • Tone mapping NPL: 0
      • Max B-Frames: -1
      • Reference frames: 0
      • Max keyframe interval: 0
  • Something we might have overlooked are Asset Viewer Settings, so here they are:
    • Videos looping: On
    • Load preview image: On
    • Load original image: Off
  • App Version 1.106.3 build.143. Server Version 1.106.4
  • My videos are FHD 60fps.
  • To reproduce the issue:
    • Videos must be backed up on Immich but present on the device (AKA little cloud with checkmark icon)
    • Videos must be adjacent (right next to each other in the timeline)
    • One needs to swipe from one video to the other.

carloslockward avatar Jul 02 '24 15:07 carloslockward

I wonder if this is related to your video recording settings. Can you share it so that I can reproduce it?

Quite interesting.

I have recorded 2 videos with my phone.

When i swipe between them in the immich app it crashes. But if i delete the files from my phone and use the cloud video it works without issues.

RaulGw4 avatar Jul 02 '24 19:07 RaulGw4

Update

I have installed the latest version of the android app on my phone (1.107.1). I have recorded 2 new videos and it doesn't seem to happen to those anymore.

BUT! The old ones still are the same. I have used the exact same phone, app, settings to record.

https://github.com/immich-app/immich/assets/116492323/c6262f23-c244-4267-91ce-53f06eba4aa3

RaulGw4 avatar Jul 02 '24 20:07 RaulGw4

Update

I have installed the latest version of the android app on my phone (1.107.1). I have recorded 2 new videos and it doesn't seem to happen to those anymore.

BUT! The old ones still are the same. I have used the exact same phone, app, settings to record.

screen.mp4

@RaulGw4 I think the video might be too short to reproduce the issue! Try recording a longer video maybe 20 seconds at least?

carloslockward avatar Jul 03 '24 14:07 carloslockward

Update

I have installed the latest version of the android app on my phone (1.107.1). I have recorded 2 new videos and it doesn't seem to happen to those anymore.

BUT! The old ones still are the same. I have used the exact same phone, app, settings to record.

screen.mp4

@RaulGw4 I think the video might be too short to reproduce the issue! Try recording a longer video maybe 20 seconds at least?

You are right.

I have recorded 2 new videos that are 20 seconds long and it is happening.

RaulGw4 avatar Jul 03 '24 14:07 RaulGw4

I copied two videos from the WhatsApp video folder to my camera folder which syncs with immich. The videos are on my device and on remote and I can switch between without problems.

So it seems like it really has something to do with the video encoding or something like this.

desmond206x avatar Jul 03 '24 20:07 desmond206x

I copied two videos from the WhatsApp video folder to my camera folder which syncs with immich. The videos are on my device and on remote and I can switch between without problems.

So it seems like it really has something to do with the video encoding or something like this.

Whatsapp videos are compressed heavily.

Perhaps is not the video encoding but its size. Which would explain why very short videos also don't have the issue.

carloslockward avatar Jul 03 '24 21:07 carloslockward

My app crashed again. But now after 10 minutes of scrolling and viewing images and videos.. I had some issues with not playing videos sometimes and later the app crashed while starting a video. I think there are some major memory leaks and the "fix" here just delays the problem.

desmond206x avatar Jul 15 '24 20:07 desmond206x

Maybe just recycler? 🤷‍♂️

Apps like Glimpse don't use more memory no matter period of scrolling. And more loading assets increases memory usage here.

I also still suspect these users aren't getting crashes, rather lmkd kills like me (when app reached ~6G memory usage from scrolling). No logcat excerpts shared though.

RealJohnGalt avatar Jul 16 '24 22:07 RealJohnGalt