element-hq / element-hq/element-x-android
Blank screen at launch after the homeserver expires the sliding sync connection (400 M_UNKNOWN_POS)
- Dominant language
- Kotlin
- Stars
- 2.4k
- Forks
- 624
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 149
Description
### Steps to reproduce
1. Sign in to Element X Android and use it normally.
2. Leave the app unopened for more than 7 days. On several Android OEM builds (Xiaomi, realme, TECNO) aggressive battery management freezes the app, so it never wakes up in the background even with push configured.
3. Open the app.
### Outcome
**What did you expect?**
The app notices that the homeserver no longer knows its sliding sync position, restarts the sync from scratch and renders the room list.
**What happened instead?**
The app stays on a blank white screen indefinitely. The only workaround our users found is to clear app data / reinstall and sign in again.
That workaround is expensive: a fresh session restores the timeline from key backup, so every older message then carries the "The authenticity of this encrypted message can't be guaranteed on this device." shield.
**Server side**
Synapse deletes sliding sync connections that have not been used for `CONNECTION_EXPIRY = 7 days` (`synapse/storage/databases/main/sliding_sync.py`, cleanup runs hourly). After that the client's request
```
POST /_matrix/client/unstable/org.matrix.simplified_msc3575/sync?pos=&timeout=0
```
is answered with `400 M_UNKNOWN_POS` ("Unknown position"). The app does not appear to recover from that response.
**Scale on one self-hosted server** (Synapse 1.160.0, ~250 users, ~470 active sessions):
- 12 to 18 occurrences per day
- 11 distinct Android devices over 48 hours
- zero iOS devices, although iOS is roughly a third of the sessions here
- affected versions range from 26.05.1 to 26.09.1, so upgrading does not help
### Your phone model
Xiaomi (23028RNCAG, 2409BRN2CY, 23053RN02Y, 22120RN86G, M2006C3MNG, 24117RN76O), realme RMX3890, TECNO CL7, Samsung SM-A065F
### Operating system version
Android 10 through 16
### Application version and app store
Element X Android 26.05.1 to 26.09.1 (Google Play). Every observed version is affected, including the newest.
### Homeserver
Self-hosted Synapse 1.160.0 with Matrix Authentication Service
### Will you send logs?
No
### Will you submit a Pull Request?
No
Contributor guide
Research direction
Use the reproduction steps to trigger a stale sliding-sync position, then inspect the Android handling of the sync POST response for 400 M_UNKNOWN_POS. The server-side expiry behavior is described in synapse/storage/databases/main/sliding_sync.py. Done means the app recovers from the expired position and renders the room list without clearing app data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100