Fix deadlock that can occur when initializing RootViewCoordinator
#20300
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #20297
Description
I was unable to reproduce the crash, but from the stack trace, it's obvious that it's a deadlock. The deadlock is triggered by initializing the shared instance of
RootViewCoordinator. Apparently, in some cases, the code path of initializingRootViewCoordinatorends up inNotificationsViewController.configureJetpackBanner, which callsRootViewCoordinator.sharedto decide if JP features are enabled or not. To fix this deadlock, I've removed the dependency ofJetpackFeaturesRemovalCoordinator.jetpackFeaturesEnabledonRootViewCoordinator.Testing Instructions
I wasn't able to reproduce the crash, so there are no specific testing instructions. Please review the code carefully. And retest #20275's testing instructions because the fix in this PR overrides the changes made in #20275.
Regression Notes
Potential unintended areas of impact
Jetpack features removal
What I did to test those areas of impact (or what existing automated tests I relied on)
Manually tested going back and forth from the normal phase, phase 4, and new users phase.
I also retested Jetpack Focus: Avoid premature removal of features #19954's testing instructions.
What automated tests I added (or what prevented me from doing so)
N/A
PR submission checklist:
RELEASE-NOTES.txtif necessary.