Skip to content
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

fix: NotificationChannelGroup crash (WPB-6233) #2687

Merged
merged 2 commits into from Feb 13, 2024

Conversation

borichellow
Copy link
Contributor

@borichellow borichellow commented Feb 12, 2024

BugWPB-6233 [Android] Notification playstore crash with createNotificationChannel

What's new in this PR?

Issues

crash:
https://play.google.com/console/u/2/developers/7098984309886892484/app/4973241010395499500/vitals/crashes/cb7ccba8c13d0a497df6edf45962bb4f/details?days=7&isUserPerceived=true

Causes (Optional)

Logs says that app is trying to create a NotifcationChannel in a NotifcationChannelGroup that doesn't exist. This looks strange as we create Group first and only after it create channels in that group.
So it's hard to reproduce the crash.

From the logs in DataDog found out that at least some part of the crashes happens after logout.
AND deleting the NotifcationChannelGroup is called from a few places (basically on logout) and launched in a separate CoroutineScope.

So there is a theory that when user logs out, GlobalObserversManager.setUpNotifications gets invalid data first (list of users with logged out user) and after some time - valid data. This makes the app create notification group and channels for the user who is logged out. And somewhere during this in another CoroutineScope deleteNotificationChannelGroup is called.

Solutions

Move calling deleteNotificationChannelGroup into the same CoroutineScope to escape such conflicts.
For that update NotificationChannelsManager.createUserNotificationChannels to not just create Groups and Channels for "active" users, but also remove the Groups and Channels that don't belong to any "active" user.

@borichellow borichellow self-assigned this Feb 12, 2024
@borichellow borichellow changed the base branch from develop to release/candidate February 12, 2024 14:36
Copy link

Ups 🫰🟨

This PR is too big. Please try to break it up into smaller PRs.

Copy link
Contributor

Test Results

794 tests   794 ✅  12m 38s ⏱️
108 suites    0 💤
108 files      0 ❌

Results for commit 99103d1.

Copy link
Contributor

APKs built during tests are available here. Scroll down to Artifacts!

@AndroidBob
Copy link
Collaborator

Build 3064 succeeded.

The build produced the following APK's:

@borichellow borichellow merged commit 7914307 into release/candidate Feb 13, 2024
14 checks passed
@borichellow borichellow deleted the fix/notification_channel_group_crash branch February 13, 2024 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants