Fenix: FNX2-15980 โƒ [Bug] Fenix is stuck after a few second

Created on 7 May 2020  ยท  14Comments  ยท  Source: mozilla-mobile/fenix

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

  • Very similar to #10110 and #10488. It may be the same problem.
  • After I tested a few times I noticed that is 100% reproducible if you tap fast on the 3 dot menu after you opened the app. In case you wait a few seconds (let's say 10s) before opening the menu the bug will not reproduce.
  • I don't know if it's related, but I was already logged in.
  • Video
HomeScreen MainMenu S1 engverified ready help wanted ๐Ÿž bug

Most helpful comment

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

2) 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?

All 14 comments

I just saw this and it's quite disruptive.

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

2) 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?

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 ๐Ÿค”

This reproduces reliably for me.

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.

Thanks for explaining, I suppose this thread can be closed now ๐Ÿ™‚

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

Great!

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

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.

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?

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

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

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

Was this page helpful?
0 / 5 - 0 ratings