java.lang.IllegalStateException:
at androidx.fragment.app.FragmentManager.ensureExecReady (FragmentManager.java:4)
at androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:1)
at androidx.fragment.app.FragmentManager$4.run (FragmentManager.java:1)
at android.os.Handler.handleCallback (Handler.java:873)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7073)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:964)
https://sentry.prod.mozaws.net/operations/fenix-nightly/issues/6457309/?query=is:unresolved%20ensureExecReady
Looks like STR here? https://github.com/mozilla-mobile/fenix/issues/8374
Also we probably only need one of these (looks the same as #8405 as well)
STR for me:
With some logging I see that for some reason we recreate the browser activity on switching AND even create one that we immediately destroy. That is weird.
W (+) onCreate(android.intent.action.MAIN): 265958844 // Launching Fenix
|
W (-) onDestroy(android.intent.action.MAIN): 265958844 // Switching to private mode:
W (+) onCreate(android.intent.action.MAIN): 133400951 // Recreating activity (to apply theme)
|
| W (+) onCreate(android.intent.action.VIEW): 249927606 // Launching custom tab
| |
| W (-) onDestroy(android.intent.action.VIEW): 249927606 // Leaving custom tab after clicking "Open in Fenix"
|
| W (+) onCreate(android.intent.action.VIEW): 117827452 // Creating new activity?
| |
| W (-) onDestroy(android.intent.action.VIEW): 117827452 // Destroying it immediately??
|
W (-) onDestroy(android.intent.action.MAIN): 133400951 // Destroying browser
W (+) onCreate(android.intent.action.MAIN): 193142077 // Creating a new browser
When I comment out activity.recreate() in ThemeManager then this looks better and does not crash:
W (+) onCreate(android.intent.action.MAIN): 187589969 // Launching Fenix
|
| W (+) onCreate(android.intent.action.VIEW): 57155225 // Launching custom tab
| |
| W (-) onDestroy(android.intent.action.VIEW): 57155225 // Leaving custom tab
I wonder:
ThemeManager recreate too often (why do we have this activity that gets destroyed?)?I do not know what is happening to the fragment manager actually causing this crash. However in AC we have seen Activity.recreate() causing issues when being used with viewLifecycleOwner.lifecycleScope (the scope doesn't get cancelled in some situations). Maybe related. Maybe not.
Looking at ThemeManager I see us twice determining we are in private mode but should be in normal mode which causes the recreate().
I also noticed that even though we show the custom tab in private tab colors, it is not actually a private tab (that doesn't seem right?) - which may be another reason why we try to switch to normal mode (although that should work too).
The relevant PR is here: https://github.com/mozilla-mobile/fenix/pull/8740
I think we'll need to verify #8637 and then keep an eye on Sentry in Nightly to verify all crashes with this trace have been fixed
This crash trace reported on #8637 doesn't reproduce anymore with the STR provided. Although, https://github.com/mozilla-mobile/fenix/issues/8374#issuecomment-591336307 seems that it's still crashing but with a different error.
@ekager should I leave this open until Sentry reports confirm it?
Closing as this was verified
Most helpful comment
Looks like STR here? https://github.com/mozilla-mobile/fenix/issues/8374