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

(GeckoView) IllegalStateException Display already acquired #534

Closed
pocmo opened this issue Jan 31, 2019 · 8 comments
Closed

(GeckoView) IllegalStateException Display already acquired #534

pocmo opened this issue Jan 31, 2019 · 8 comments

Comments

@pocmo
Copy link
Contributor

pocmo commented Jan 31, 2019

https://sentry.prod.mozaws.net/operations/reference-browser/issues/5168283/

IllegalStateException: Display already acquired
    at org.mozilla.geckoview.GeckoSession.acquireDisplay(GeckoSession.java:1799)
    at org.mozilla.geckoview.GeckoView.setSession(GeckoView.java:342)
    at org.mozilla.geckoview.GeckoView.setSession(GeckoView.java:305)
    at mozilla.components.browser.engine.gecko.GeckoEngineView.render(GeckoEngineView.kt:51)
    at mozilla.components.feature.session.EngineViewPresenter.renderSession$feature_session_release(EngineViewPresenter.kt:50)
...
(35 additional frame(s) were not displayed)

RuntimeException: Failed to call observer method
    at androidx.lifecycle.ClassesInfoCache$MethodReference.invokeCallback(ClassesInfoCache.java:225)
    at androidx.lifecycle.ClassesInfoCache$CallbackInfo.invokeMethodsForEvent(ClassesInfoCache.java:193)
    at androidx.lifecycle.ClassesInfoCache$CallbackInfo.invokeCallbacks(ClassesInfoCache.java:184)
    at androidx.lifecycle.ReflectiveGenericLifecycleObserver.onStateChanged(ReflectiveGenericLifecycleObserver.java:36)
    at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:355)
...
(27 additional frame(s) were not displayed)

Failed to call observer method
@pocmo pocmo added 🐞 bug Something isn't working 💥 crash 🦎 GeckoView labels Jan 31, 2019
@pocmo
Copy link
Contributor Author

pocmo commented Jan 31, 2019

org.mozilla.geckoview.GeckoSession in acquireDisplay at line 1799
org.mozilla.geckoview.GeckoView in setSession at line 342
org.mozilla.geckoview.GeckoView in setSession at line 305
mozilla.components.browser.engine.gecko.GeckoEngineView in render at line 51
mozilla.components.feature.session.EngineViewPresenter in renderSession$feature_session_release at line 50
mozilla.components.feature.session.EngineViewPresenter in start at line 30
mozilla.components.feature.session.SessionFeature in start at line 26

@jonalmeida
Copy link
Collaborator

I filed an issue for this in Fenix since I came across this crash organically.

@pocmo
Copy link
Contributor Author

pocmo commented Feb 1, 2019

@jonalmeida And do you have steps to reproduce this? This week is the first time this showed up both in our browser and fenix.

@jonalmeida
Copy link
Collaborator

@pocmo YES! I just figured it out!

STR:

  1. Open a link in a custom tab.
  2. Share the link from the custom tab to the same R-B.
  3. Observe the crash.

@jonalmeida
Copy link
Collaborator

I haven't landed CT in Fenix, only feature-intent, so I'm guessing that might be related in some way.

@pocmo
Copy link
Contributor Author

pocmo commented Feb 1, 2019

Perfect. Thank you!

@boek
Copy link

boek commented Feb 5, 2019

I was able to fix an instance of this in mozilla-mobile/fenix#374

@pocmo pocmo self-assigned this Feb 6, 2019
pocmo added a commit to pocmo/android-components that referenced this issue Feb 6, 2019
… a fixed session.

This fixes the following reference browser issue:
mozilla-mobile/reference-browser#534

Related to mozilla-mobile#1943
pocmo added a commit to pocmo/android-components that referenced this issue Feb 6, 2019
… a fixed session.

This fixes the following reference browser issue:
mozilla-mobile/reference-browser#534

Related to mozilla-mobile#1943
@pocmo
Copy link
Contributor Author

pocmo commented Feb 6, 2019

The cause of the crash is that we are trying to display the same GeckoSession on two GeckoView instances. :)

In the case of the Reference Browser (and STR above) this is a bug in our presenter and we try to display the selected session in the custom tab too. This will be fixed with this PR in AC:
mozilla-mobile/android-components#1967

In Fenix it looks like the Fragment instances is retained (because of the backstack) but the views are destroyed. Since the Fragment keeps a reference to the feature (and the original views) we essentially:

  • Leak the original views and keep them in memory
  • Render the session on the old and new views (since both are still subscribed)

This issue is something we do not see in our app since we never retain a Fragment and therefore for us "fragment lifetime" == "view lifetime". What we need is to bind a feature to the lifetime of the view and not to the lifecycle owner. I am working on a solution in:
mozilla-mobile/android-components#1943

csadilek pushed a commit to mozilla-mobile/android-components that referenced this issue Feb 6, 2019
… a fixed session.

This fixes the following reference browser issue:
mozilla-mobile/reference-browser#534

Related to #1943
@pocmo pocmo closed this as completed Feb 7, 2019
A-C: Android Components Sprint Planning automation moved this from In Progress to Done Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

No branches or pull requests

3 participants