Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

[Bug] Fenix is stuck after a few second #10494

Closed
ValentinTimisica opened this issue May 7, 2020 · 14 comments
Closed

[Bug] Fenix is stuck after a few second #10494

ValentinTimisica opened this issue May 7, 2020 · 14 comments
Assignees
Labels
🐞 bug Crashes, Something isn't working, .. eng:qa:verified QA Verified eng:ready Ready for engineering Feature:HomeScreen Feature:MainMenu The three-dot menu that is seen on the browser and homescreen. help wanted Help wanted from a contributor. More complex than good first issue. S1 Blocks development/testing, may impact more than 25% of users, causes data loss, potential chemspill

Comments

@ValentinTimisica
Copy link
Contributor

ValentinTimisica commented May 7, 2020

Steps to reproduce

  • Open Fenix
  • Open fast the 3 dot menu
  • Wait a few second (I waited around 10 second)
  • Press outside the menu

Expected behavior

  • The app works without issues.

Actual behavior

  • The app is stuck. You can only select the items from the menu (check the video below).

Device information

  • Android device: Samsung Galaxy Note 10 (Android 10)
  • Fenix version: latest master

Additional info

┆Issue is synchronized with this Jira Task

@ValentinTimisica ValentinTimisica added 🐞 bug Crashes, Something isn't working, .. Feature:HomeScreen Feature:MainMenu The three-dot menu that is seen on the browser and homescreen. S1 Blocks development/testing, may impact more than 25% of users, causes data loss, potential chemspill labels May 7, 2020
@github-actions github-actions bot added the needs:triage Issue needs triage label May 7, 2020
@ekager
Copy link
Contributor

ekager commented May 7, 2020

I just saw this and it's quite disruptive.

@ekager ekager added eng:ready Ready for engineering and removed needs:triage Issue needs triage labels May 7, 2020
@codrut-topliceanu codrut-topliceanu self-assigned this May 12, 2020
@ValentinTimisica
Copy link
Contributor Author

ValentinTimisica commented May 13, 2020

After further investigation I found out that you need to be logged in to reproduce the bug.
I discovered that commenting the code inside onAuthenticated will no longer reproduce the bug.

Another interesting thing is that if you open the app and don't press the 3 dot menu 3 callbacks related to FxaAccount will be triggered:

  1. in HomeMenu.kt - line
  2. in Mode.kt - line
  3. in HomeFragment.kt - line

If you open the app and press fast the 3 dot menu (in order to reproduce the bug), only the callback from HomeMenu.kt will be triggered. After commenting this line, 2 and 3 triggers.

Checked notifyObservers method and seems like if you press the 3 dot menu, it will not notify the same observers as when you open the app and don't press anything.

You can check this log to see what observers are notified in each case:

  1. When you don't press the 3 dot menu
Same observers
...
mozilla.components.service.fxa.sync.SyncManager$PassThroughSyncStatusObserver@f80bdeb
mozilla.components.service.fxa.manager.FxaAccountManager$SyncToAccountsIntegration@13aef34
org.mozilla.fenix.components.AccountAbnormalities@fd57ad2
org.mozilla.fenix.home.HomeMenu$4$1@225eaff
org.mozilla.fenix.home.CurrentMode@2e9922a
org.mozilla.fenix.home.HomeFragment$onStart$1$1@a2a4db8
mozilla.components.service.fxa.manager.FxaAccountManager$AccountsToSyncIntegration@6e0c207
org.mozilla.fenix.components.TelemetryAccountObserver@131e15d
org.mozilla.fenix.components.AccountAbnormalities@fd57ad2
org.mozilla.fenix.home.HomeMenu$4$1@225eaff
org.mozilla.fenix.home.CurrentMode@2e9922a
org.mozilla.fenix.home.HomeFragment$onStart$1$1@a2a4db8
  1. When you press the 3 dot menu
Same observers
...
org.mozilla.fenix.components.AccountAbnormalities@7ce3c82
org.mozilla.fenix.home.HomeMenu$4$1@60024fc
mozilla.components.service.fxa.sync.SyncManager$PassThroughSyncStatusObserver@baf9d8d
mozilla.components.service.fxa.manager.FxaAccountManager$SyncToAccountsIntegration@66a6f6

I hope this helps solving the issue.

@grigoryk I saw that you refactored HomeMenu-HomeFragment interaction. Can you take a look on this?

@codrut-topliceanu codrut-topliceanu removed their assignment May 14, 2020
@codrut-topliceanu codrut-topliceanu added the help wanted Help wanted from a contributor. More complex than good first issue. label May 14, 2020
@astarq
Copy link

astarq commented May 22, 2020

This has been happening for me occasionally for about a month. Sometimes the triple dot menu doesn't close when I open bookmarks or settings from it 🤔

@grigoryk grigoryk self-assigned this May 22, 2020
@grigoryk
Copy link
Contributor

This reproduces reliably for me.

@grigoryk
Copy link
Contributor

grigoryk commented May 22, 2020

Problem was that we were trying to process menu changes (in response to account manager events) on some background thread as that's what account manager emits them on, so some code internally in PopupWindow's dismiss handling (i think, didn't dig very deeply here) was silently giving up and we'd get into a bad state.

The reason this seemingly only happened if you quickly opened a menu on startup is because account manager isn't initialized until sometime after the startup finished. So the trick was to open the menu (and register account manager state callbacks) before it got initialized, so that the callbacks are invoked.

This should also reproduce in other, much more obscure ways, e.g. if you open the menu right before sync is scheduled to run in the background, change FxA password on another connected client, and then eventually receive a onAuthenticationProblem callback.

Patch incoming.

@astarq
Copy link

astarq commented May 22, 2020

Thanks for explaining, I suppose this thread can be closed now 🙂

@grigoryk
Copy link
Contributor

Once we land the patch and verify that it is, indeed, fixed :)

grigoryk pushed a commit to grigoryk/fenix that referenced this issue May 22, 2020
…n thread

Problem was that we were trying to process menu changes (in response to account manager events) on some background thread as that's what account manager emits them on, so some code internally in PopupWindow's dismiss handling (i think, didn't dig very deeply here) was silently giving up and we'd get into a bad state.

The reason this seemingly only happened if you quickly opened a menu on startup is because account manager isn't initialized until sometime after the startup finished. So the trick was to open the menu (and register account manager state callbacks) before it got initialized, so that the callbacks are invoked.

This should also reproduce in other, much more obscure ways, e.g. if you open the menu right before sync is scheduled to run in the background, change FxA password on another connected client, and then eventually receive a onAuthenticationProblem callback.
@astarq
Copy link

astarq commented May 22, 2020

Great!

ekager pushed a commit that referenced this issue May 22, 2020
Problem was that we were trying to process menu changes (in response to account manager events) on some background thread as that's what account manager emits them on, so some code internally in PopupWindow's dismiss handling (i think, didn't dig very deeply here) was silently giving up and we'd get into a bad state.

The reason this seemingly only happened if you quickly opened a menu on startup is because account manager isn't initialized until sometime after the startup finished. So the trick was to open the menu (and register account manager state callbacks) before it got initialized, so that the callbacks are invoked.

This should also reproduce in other, much more obscure ways, e.g. if you open the menu right before sync is scheduled to run in the background, change FxA password on another connected client, and then eventually receive a onAuthenticationProblem callback.
@grigoryk
Copy link
Contributor

@ValentinTimisica #10863 should be on nightly by now, can you verify that this doesn't happen anymore? Thanks :)

@ValentinTimisica
Copy link
Contributor Author

Tested and it doesn't stuck anymore for me but I saw that the 3 dot menu is automatically dismissed after a few seconds. @grigoryk is this intended?

Adding the QA label for an extra check.

@ekager
Copy link
Contributor

ekager commented May 26, 2020

Yeah @grigoryk mentioned in the #10863

One "problem" this introduces is that if you open the menu right after the startup, it will be dismissed in a few seconds (as account manager is initialized). Fixing that will require changes to a-c, so I'll leave that to a follow-up.

Is there an AC bug open for this Grisha?

@ValentinTimisica
Copy link
Contributor Author

Thanks @ekager, I missed this info when I tested earlier. That means it works well for me now.

@grigoryk
Copy link
Contributor

Thanks, @ValentinTimisica ! I'll close this issue for now then.

@liuche liuche mentioned this issue Jun 10, 2020
29 tasks
@Diana-Rus
Copy link

Hi, issue is fixed, i cannot reproduce it, checked with Samsung Galaxy S9 (Android 8) and Google Pixel 3 XL (Android 9) on Beta 5.2.0-beta.1 GV:78.0

@Diana-Rus Diana-Rus added eng:qa:verified QA Verified and removed eng:qa:needed QA Needed labels Jun 10, 2020
@data-sync-user data-sync-user changed the title [Bug] Fenix is stuck after a few second FNX2-15980 ⁃ [Bug] Fenix is stuck after a few second Jul 30, 2020
@data-sync-user data-sync-user changed the title FNX2-15980 ⁃ [Bug] Fenix is stuck after a few second FNX-4326 ⁃ [Bug] Fenix is stuck after a few second Aug 10, 2020
@data-sync-user data-sync-user changed the title FNX-4326 ⁃ [Bug] Fenix is stuck after a few second FNX3-13939 ⁃ [Bug] Fenix is stuck after a few second Aug 10, 2020
@data-sync-user data-sync-user changed the title FNX3-13939 ⁃ [Bug] Fenix is stuck after a few second FNX-4326 ⁃ [Bug] Fenix is stuck after a few second Aug 11, 2020
@data-sync-user data-sync-user changed the title FNX-4326 ⁃ [Bug] Fenix is stuck after a few second FNX2-15980 ⁃ [Bug] Fenix is stuck after a few second Aug 11, 2020
@data-sync-user data-sync-user changed the title FNX2-15980 ⁃ [Bug] Fenix is stuck after a few second [Bug] Fenix is stuck after a few second May 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Crashes, Something isn't working, .. eng:qa:verified QA Verified eng:ready Ready for engineering Feature:HomeScreen Feature:MainMenu The three-dot menu that is seen on the browser and homescreen. help wanted Help wanted from a contributor. More complex than good first issue. S1 Blocks development/testing, may impact more than 25% of users, causes data loss, potential chemspill
Projects
None yet
Development

No branches or pull requests

7 participants