fenix icon indicating copy to clipboard operation
fenix copied to clipboard

[Bug] Fenix is stuck after a few second

Open ValentinTimisica opened this issue 6 years ago • 14 comments

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

┆Issue is synchronized with this Jira Task

ValentinTimisica avatar May 07 '20 14:05 ValentinTimisica

I just saw this and it's quite disruptive.

ekager avatar May 07 '20 16:05 ekager

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?

ValentinTimisica avatar May 13 '20 12:05 ValentinTimisica

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 🤔

astarq avatar May 22 '20 15:05 astarq

This reproduces reliably for me.

grigoryk avatar May 22 '20 17:05 grigoryk

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.

grigoryk avatar May 22 '20 18:05 grigoryk

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

astarq avatar May 22 '20 18:05 astarq

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

grigoryk avatar May 22 '20 18:05 grigoryk

Great!

astarq avatar May 22 '20 19:05 astarq

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

grigoryk avatar May 25 '20 22:05 grigoryk

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.

ValentinTimisica avatar May 26 '20 06:05 ValentinTimisica

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?

ekager avatar May 26 '20 13:05 ekager

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

ValentinTimisica avatar May 26 '20 13:05 ValentinTimisica

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

grigoryk avatar May 26 '20 16:05 grigoryk

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 avatar Jun 10 '20 11:06 Diana-Rus