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

(onProcessKilled) Crash while browsing: IllegalArgumentException: Display not attached #12436

Closed
ekager opened this issue Jul 9, 2020 · 9 comments
Assignees
Labels
b:crash Crashes Fenix: should link to Sentry, Crash-Stats or GPlay info needs:ac Needs Android Component Work

Comments

@ekager
Copy link
Contributor

ekager commented Jul 9, 2020

Just ran into this while testing something else in Fenix. Don't have exact STR but I was opening/closing/switching tabs and toggling PB and then backgrounded the app I think? (did NOT have to do with custom tabs though)
Going to file just to keep open in case someone else runs into it as well.
(cc @pocmo )

java.lang.IllegalArgumentException: Display not attached
        at org.mozilla.geckoview.GeckoSession.releaseDisplay(GeckoSession.java:2438)
        at org.mozilla.geckoview.GeckoView.releaseSession(GeckoView.java:393)
        at org.mozilla.geckoview.GeckoView.setSession(GeckoView.java:436)
        at mozilla.components.browser.engine.gecko.GeckoEngineView.rebind(GeckoEngineView.kt:150)
        at mozilla.components.browser.engine.gecko.GeckoEngineView.access$rebind(GeckoEngineView.kt:27)
        at mozilla.components.browser.engine.gecko.GeckoEngineView$observer$1.onProcessKilled(GeckoEngineView.kt:68)
        at mozilla.components.browser.engine.gecko.GeckoEngineSession$createContentDelegate$1$onKill$2.invoke(GeckoEngineSession.kt:649)
        at mozilla.components.browser.engine.gecko.GeckoEngineSession$createContentDelegate$1$onKill$2.invoke(GeckoEngineSession.kt:612)
        at mozilla.components.support.base.observer.ObserverRegistry.notifyObservers(ObserverRegistry.kt:137)
        at mozilla.components.concept.engine.EngineSession.notifyObservers(Unknown Source:7)
        at mozilla.components.browser.engine.gecko.GeckoEngineSession$createContentDelegate$1.onKill(GeckoEngineSession.kt:649)
        at org.mozilla.geckoview.GeckoSession$2.handleMessage(GeckoSession.java:370)
        at org.mozilla.geckoview.GeckoSession$2.handleMessage(GeckoSession.java:359)
        at org.mozilla.geckoview.GeckoSessionHandler.handleMessage(GeckoSessionHandler.java:90)
        at org.mozilla.gecko.EventDispatcher$3.run(EventDispatcher.java:356)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

┆Issue is synchronized with this Jira Task

@ekager ekager added needs:ac Needs Android Component Work b:crash Crashes Fenix: should link to Sentry, Crash-Stats or GPlay info labels Jul 9, 2020
@github-actions github-actions bot added the needs:triage Issue needs triage label Jul 9, 2020
@ekager ekager removed the needs:triage Issue needs triage label Jul 9, 2020
@ekager ekager changed the title Crash: IllegalArgumentException: Display not attached Crash while browsing: IllegalArgumentException: Display not attached Jul 10, 2020
@pocmo
Copy link
Contributor

pocmo commented Jul 10, 2020

This is an interesting stacktrace.

The call goes through onProcessKilled() which means that the content process got killed by Android (It did not crash, but Android is reclaiming system resources by killing it), which also makes it very likely that you backgrounded the app, as you said.

In that situation, under the hood, we are creating a new GeckoSession, restoring the last state for it, and then we try to render the new GeckoSession. And that's where it is crashing with Display not attached here.

We implemented this in:

Back then this situation was easy to reproduce by using kill -9 on the content process. Maybe that can help reproducing this crash here now.

I'm going to move this into the AC sprint too.

@pocmo pocmo self-assigned this Jul 10, 2020
@pocmo
Copy link
Contributor

pocmo commented Jul 10, 2020

I tried to reproduce this with the STR from #1577 but wasn't successful.

@pocmo
Copy link
Contributor

pocmo commented Jul 10, 2020

I found some similar stacktraces on Sentry and merged them together.

@pocmo
Copy link
Contributor

pocmo commented Jul 10, 2020

Sentry issue: FENIX-53P

@pocmo pocmo changed the title Crash while browsing: IllegalArgumentException: Display not attached (onProcessKilled) Crash while browsing: IllegalArgumentException: Display not attached Jul 13, 2020
@data-sync-user data-sync-user changed the title (onProcessKilled) Crash while browsing: IllegalArgumentException: Display not attached FNX3-15389 ⁃ (onProcessKilled) Crash while browsing: IllegalArgumentException: Display not attached Aug 11, 2020
@data-sync-user data-sync-user changed the title FNX3-15389 ⁃ (onProcessKilled) Crash while browsing: IllegalArgumentException: Display not attached FNX-13499 ⁃ (onProcessKilled) Crash while browsing: IllegalArgumentException: Display not attached Aug 11, 2020
@data-sync-user data-sync-user changed the title FNX-13499 ⁃ (onProcessKilled) Crash while browsing: IllegalArgumentException: Display not attached FNX2-15244 ⁃ (onProcessKilled) Crash while browsing: IllegalArgumentException: Display not attached Aug 11, 2020
@pocmo
Copy link
Contributor

pocmo commented Aug 13, 2020

After mozilla-mobile/android-components#7867 lands in AC we can rewrite that logic in AC. Instead of recreating a GeckoSession and restoring it, we will be able to "suspend" the whole tab, only keeping it's EngineSessionState. So that an individual tab will only be restored when it is needed the next time.

@kbrosnan kbrosnan changed the title FNX2-15244 ⁃ (onProcessKilled) Crash while browsing: IllegalArgumentException: Display not attached (onProcessKilled) Crash while browsing: IllegalArgumentException: Display not attached Aug 29, 2020
@liuche
Copy link
Contributor

liuche commented Aug 31, 2020

We're doing a crash sprint, and wondering what the next work is here, and whether we can pick up/split any of this work.

@pocmo
Copy link
Contributor

pocmo commented Sep 7, 2020

Patch landed in AC.
Fenix counter part: #14823

@ekager
Copy link
Contributor Author

ekager commented Sep 9, 2020

Should we close this since #14823 has landed?

@pocmo
Copy link
Contributor

pocmo commented Sep 9, 2020

Yes, let's close it. I have some other issues for other white screen problems.. :)

@pocmo pocmo closed this as completed Sep 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
b:crash Crashes Fenix: should link to Sentry, Crash-Stats or GPlay info needs:ac Needs Android Component Work
Projects
None yet
Development

No branches or pull requests

3 participants