-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix(messaging, android): properly remove stored remote messages to avoid OOM #8776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
8bd80f4 to
9f556ae
Compare
it was duplicated, which means any fixes have to be in multiple spots
previously the remove was not applied, so it likely never persisted to storage, leading to infinite growth and possible OOM
previously, stored messages were cleared one at a time each time a message came in, opening the possibility that the store would contain more messages then the limit and never get back down to the limit. now it will attempt to shrink down to the limit every time a message comes in ensuring that if there is an over limit condition it will be fixed quickly
previously we added before purging, so if close to an OOM we would trigger it, if an app update is pushed with this change, it will ideally recover completely from this situation by purging the store down before any new data is added
9f556ae to
7e8975e
Compare
| preferences.setStringValue(S_KEY_ALL_NOTIFICATION_IDS, notificationIds); | ||
|
|
||
| // check and remove old notifications message | ||
| // remove old notifications message before store to free space as needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the diff for the 5th commit is easier to understand in split view, it's mostly code motion swapping the two chunks of logic, not code change
sean5940
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏻
This PR provides a necessary and correct fix for the recurring OOM risk caused by uncontrolled remote message storage in SharedPreferences.
Description
@sean5940 noticed a few issues with our remote message storage implementation while collaborating on the related PR
They are serious enough I'd like to get fixes for them out as soon as possible, independent of the work on that PR
There are 5 tiny commits here so that the problems were hopefully immediately obvious and the fixes are hopefully obviously correct
First two are just refactors for clarity.
The last three are the fixes
Related issues
Release Summary
two refactor commits / three fix commits, it will generate a fix release
Checklist
AndroidiOSOther(macOS, web)e2etests added or updated inpackages/\*\*/e2ejesttests added or updated inpackages/\*\*/__tests__Test Plan
Hoping for @sean5940 to try these with the patch-package set that the PR run generates to see what he thinks, or you could pull the branch directly?
Think
react-native-firebaseis great? Please consider supporting the project with any of the below:React Native FirebaseandInvertaseon Twitter