element-hq / element-android

A Matrix collaboration client for Android.
https://element.io/
GNU Affero General Public License v3.0
3.39k stars 734 forks source link

Crashing very often (every few minutes) #5499

Open throwawayacc987654321 opened 2 years ago

throwawayacc987654321 commented 2 years ago

Steps to reproduce

App is crashing on random occassions.

Outcome

It's crashing every few minutes. I couldn't figure out why. Sometimes it crashed immediately after sending a message. It often crashes while scrolling back in timeline. However, often it happens randomly, for example, while in a call, and there is no activity in the app (no new messages received or sent), but it happens after a much longer time interval than when I use the app.

I sent numerous crash reports using the in-app crash reporting feature. Every time it displayed the "Do you send crash reports?" dialog, I clicked yes. This demostrates how often this happens.

Do you see these crash reports?

Your phone model

Sent using in-app crash report feature.

Operating system version

Sent using in-app crash report feature.

Application version and app store

1.4.2, but it happens since 1.4.0 (or maybe even in 1.3.18)

Homeserver

Sent using in-app crash report feature.

Will you send logs?

I have already sent many, and will send more.

ouchadam commented 2 years ago

thanks for sending the logs, it looks like the crash you're getting is caused the system running out of memory whilst attempt to read the homeserver response

Thread: OkHttp Dispatcher, Exception: java.lang.OutOfMemoryError: Failed to allocate a 24 byte allocation with 0 free bytes and 0B until OOM, target footprint 231352600, growth limit 201326592
at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:813)

I believe the crash is caused by the F-droid process always needing to be running in order to check for new messages (otherwise we might miss some), a temporary workaround may be to force stop Element and relaunch every now and then~

related issue #5244

throwawayacc987654321 commented 2 years ago

@ouchadam I don't think it's caused by the F-Droid flavour running constantly.

5244 is about storage space, but this error is about OOM. My phone has sufficient free space (multiple gigabytes) every time it crashes.

The latest crash was reproduced by fast scrolling back in encrypted rooms. Probably the parallel decryption of many events consumed too much memory.

Have you checked the other crash reports too? Is the error message the same? I'm curious about the crashes that occured during voice calls. 30-50 minutes into a call, it always crashing, and it's unlikely the database caused them. There were no new messages sent or received during the calls.

A memory leak somewhere?

ouchadam commented 2 years ago

the issue with out of memory crashes is that it's very tricky determine if the crash is caused by us using too much memory or the system/OS being restrictive with the amount of ram (and the ramping up of ram) each application is allowed to use.

Samsung used to be notorious for triggering OOM when apps requested too much memory too quickly, such as loading a bitmap or receiving a large network request.

If possible, are you able to see if version 1.4.4 helps with your issue?