-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Problem
Summary
Status is frequently killed by Android while in background for 1-2 mins, forcing re-authentication and slow startup to get back to the screen the user originally was. The UX is also affected by the loss of in-memory state (e.g. drafted, but not sent message in composer).
Reporter: IFT member.
Devices: Samsung Galaxy Fold 5 and Pixel 9 Pro Fold with GrapheneOS.
App Version 2.33.2
Environment
Build | 2.33.2 |
Devices | Samsung Galaxy Fold 5 (12 GB RAM), Pixel Fold 9 Pro (GrapheneOS) |
Android | 14 |
Battery saver | off |
Background process limit | Standard (default) |
Status profiles | 3, only 1 active |
Dataset size | 9 contacts, 1 community (Status), ~500 msgs, 62 images |
How does the problem affect the UX?
Users are experiencing frequent and rapid termination of the Android application process when it's placed in the background. This occurs consistently after only 1-2 minutes of using other applications. Upon returning to the app, Status restarts completely, forcing the user to:
- Re-select their profile, even if only one profile is primarily used (this problem will be resolved separately by Auto select last profile on app start - Biometric #22447).
- Re-authenticate using biometrics or password.
- Endure a slow startup sequence (measured at ~7-10 seconds average, including an initial black screen) before reaching their previous screen (e.g. a specific chat).
This behavior introduces significant friction, making multitasking or briefly checking other apps highly disruptive. The issue is not believed to be an application crash (confirmed by lack of Sentry crash reports during reproduction) but rather the Android OS aggressively killing the process, likely due to high resource consumption, specifically memory.
Steps to reproduce
The bug is likely not deterministically reproducible, otherwise we would have caught it in our testing and personal usage. @ilmotta has also experienced this problem, but very rarely after creating a new profile and with NO data.
It is clear that the app can be terminated by the OS even with small DB sizes.
- The user does NOT have push notifications enabled.
- User confirmed battery saver modes or non-standard background process limits were NOT enabled in Android Developer options.
- Launch and use the Status app on an affected Android device.
- Switch away from Status to another application (e.g. Discord, Browser).
- Use the other application(s) for approximately 1-2 minutes (switching between 2-3 apps during this time also triggers it). Consider waiting more than 3 minutes.
- Switch back to the Status app.
- Observe the app re-initializing. In practice, you will see the profiles list screen, as if you logged out.
Expected behavior
The app process should remain alive in the background for a reasonable duration on modern devices with ample RAM (like a 12GB Fold 5), especially after only 1-2 minutes. Background termination should not happen after hours of leaving Status in the background.
Actual behavior
- Frequent process kills.
Analysis and root cause investigation
The Desktop Core team has prioritized and started profiling status-go memory usage. Reach out to @jrainville or @osmaczko for more details.
- High memory usage (the primary suspect): User provided
meminfo
dumps showing the app's Resident Set Size (RSS) hovering around ~850MB during normal foreground usage on a device with 12GB RAM. This relatively high footprint likely makes it a prime candidate for Android's Low Memory Killer (LMK) when backgrounded, even on high-spec devices and even with a relatively small user data profile. - Memory spike at login: a significant jump in memory was observed: ~370MB on the profile selection screen jumping to ~850MB immediately after login/initialization.
- Evidence strongly points to the OS terminating the process (likely LMK) rather than an application crash.
Recommendations
- Use Android Studio to profile the app, or Go pprof to find top allocators.
- Investigate how the frontend code (excluding status-go) is affecting the total memory consumption.
- Function ActivityManager#gethistoricalprocessexitreasons might prove to be helpful if we log its results.
- Investigate if we could reduce large memory allocations during initialization, for example by lazy loading more aggressively, both in status-go and frontend.
- Investigate potential memory leaks.
- Investigate if the Android API can help us mitigate the LMK daemon, for example by using
onTrimMemory
(see https://developer.android.com/topic/performance/memory). - Check how we can aggressively release resources when the app is backgrounded, e.g. image or data caches.
- Check if we can reduce CPU usage while the app is backgrounded by reducing the number of active go routines.
Metadata
Metadata
Assignees
Type
Projects
Status