element-android icon indicating copy to clipboard operation
element-android copied to clipboard

Corrupted state and crash on resync

Open schuelermine opened this issue 1 year ago • 6 comments

Steps to reproduce

I recently re-opened the app, and after a screen purporting to sync my data, I was greeted with a Space I frequent—but empty. Tapping the Spaces button showed that Element thought I was in no spaces. When pressing back, I was greeted by a list of rooms that were titled incorrectly, with no icons, and in no discernible order. Some of them were erroneously marked as empty. When opening any of the rooms, all user profile pictures were missing. It was at this point that I noticed that my profile picture in the top left was missing, too. After closing the app and re-opening it, I was shown a Space I had no recollection of with no rooms in it. After going back to the overview, I found that this “space” was in fact a room. I went to the settings to check if my e-mail and username data was still there—it was. After clearing the cache, Element crashed after a very long time of waiting for a server response, by showing a white screen and then ending with an ANR modal. I reopened Element to see if the situation could be salvaged, and Element asked me to report the crash. I tried to, but Element crashed while reporting the crash. After reopening Element again, I managed to successfully report the crash (hopefully). Since I have background ANRs on, I received a number of crashes from Element even after closing it. I have reported the original issue and the crash via the in-app reporting form as best I could, incl. logs etc..

Outcome

What did you expect?

The app behaves normally.

What happened instead?

See steps above.

Your phone model

Google Pixel 6

Operating system version

GrapheneOS, based on Android 13

Application version and app store

Element version 1.5.12, installed from Play Store

Homeserver

matrix.org

Will you send logs?

Yes

Are you willing to provide a PR?

No

schuelermine avatar Dec 16 '22 23:12 schuelermine

Here is an album of screenshots: https://imgur.com/a/V89f70F The notification bar and controls bar is missing in most of these screenshots because I took it from the open apps overview.

schuelermine avatar Dec 16 '22 23:12 schuelermine

My Matrix username is @schuelermine:matrix.org if you need this to match with the submitted logs & crash report

schuelermine avatar Dec 16 '22 23:12 schuelermine

I have just discovered a new element: While inspecting the broken state, I checked what tapping my username in the settings showed. It showed an empty dialog box. I didn't know this was unintended at the time, bit have now found it should be pre-filled with the current username. I believe this may illuminate an aspect of the issue: My username appears to have been corrupted.

schuelermine avatar Dec 17 '22 00:12 schuelermine

I had something similar after what seemed like a resync or "preparation" after the latest Element beta update - all rooms replaced with just two, both were claimed to be "Empty Room", when I opened one up it was indeed empty but when I looked at the room details it says it's members are "X, Y, Z and -4 others" (and this is used as the title of the room, which doesn't have its normal name) while there are "0 people", so clearly it thinks there are and there aren't people in them. It also thinks it has no local addresses.

Turning off and on threaded messages in Labs (once I remembered where to tap without my profile icon being there) caused a resync that cleared the corrupted state.

GreenReaper avatar Dec 17 '22 04:12 GreenReaper

I received various reports for similar issues since updating SchildiChat from Element v1.5.11 to the v1.5.12 codebase. I suspect something in the "enable threads by default" migration is faulty. Usually, a fresh initial sync could fix this, but a couple of reports claim that they had to completely re-install the app to fix the issue, while initial sync either got stuck in ANR or when it finished didn't fix anything.

SpiritCroc avatar Dec 17 '22 09:12 SpiritCroc

I am going to prepare a hotifx 1.5.13. The app is crashing a lot, due to OOM when parsing the sync response. Seems to be since 1.5.8 (so previous release). The crash can be delayed when a incr sync response is handled, because some treatment on ephemerals Event are done in the next sync. I will add largeHeap=true in the AndroidManifest, this fixes the crash. I know this is common bad practice, but this is a temporary measure. On my device, I get: Heap size: 48 MB Large Heap size: 576 MB, so 12 times larger. The ephemeral event for Matrix HQ room is 6MB+ of data. This is maybe bigger due to read receipt on threads (still an hypothesis for now)

bmarty avatar Dec 19 '22 16:12 bmarty