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 deadlock that can occur when initializing RootViewCoordinator #20300

Merged
merged 3 commits into from
Mar 12, 2023

Conversation

hassaanelgarem
Copy link
Contributor

@hassaanelgarem hassaanelgarem commented Mar 10, 2023

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 initializing RootViewCoordinator ends up in NotificationsViewController.configureJetpackBanner, which calls RootViewCoordinator.shared to decide if JP features are enabled or not. To fix this deadlock, I've removed the dependency of JetpackFeaturesRemovalCoordinator.jetpackFeaturesEnabled on RootViewCoordinator.

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

  1. Potential unintended areas of impact
    Jetpack features removal

  2. 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.

  3. What automated tests I added (or what prevented me from doing so)
    N/A

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@wpmobilebot
Copy link
Contributor

You can test the changes in WordPress from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr20300-177cbde on your iPhone

If you need access to App Center, please ask a maintainer to add you.

Copy link
Contributor

@momo-ozawa momo-ozawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, in some cases, the code path of initializing RootViewCoordinator ends up in NotificationsViewController.configureJetpackBanner, which calls RootViewCoordinator.shared to decide if JP features are enabled or not.

Nice work investigating! I looked at the code and everything checks out. I also tested manually according to instructions on #20275 - works as described.

@momo-ozawa
Copy link
Contributor

FYI @mokagio 🙇‍♀️

@wpmobilebot
Copy link
Contributor

You can test the changes in Jetpack from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr20300-177cbde on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@peril-wordpress-mobile
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 4 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@hassaanelgarem hassaanelgarem merged commit ee0162d into release/21.9 Mar 12, 2023
@hassaanelgarem hassaanelgarem deleted the fix/20297-rootviewcoordinator-deadlock branch March 12, 2023 14:42
@mokagio mokagio mentioned this pull request Mar 15, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants