StrictMode LeakedClosableViolation: we're not releasing the Surface we created using SurfaceControlManager
Categories
(GeckoView :: General, defect, P3)
Tracking
(firefox107 affected, firefox108 affected, firefox109 affected)
People
(Reporter: cpeterson, Unassigned, NeedInfo)
References
Details
While testing bug 1797558, Arturo reports the following LeakedClosableViolation
(bug 1797558 comment 4) when navigating from one extension page to another extension page.
jnicol says this warning means we are not explicitly releasing the Surface we created using SurfaceControlManager.
STR (from bug 1797558 comment 0):
- Open uBlock Origin's panel (install if needed)
- Click on Dashboard.
- Click on the eye icon, e.g. at uBlock Filters. This will trigger a navigation to a page within the extension a moz-extension:-URL
4 .Observe that the tab is created but cannot be interacted with, and still renders whatever what was previously displayed (e.g. the displayed tab from step 3).
Not recording metadata (canAddUri=false) for: moz-extension://d50c45a6-02ef-41a1-8686-7e458d541b14/asset-viewer.html?url=ublock-filters
2022-10-24 17:04:37.853 26451-26795 lla.fenix.debug org.mozilla.fenix.debug I Explicit concurrent copying GC freed 231988(8713KB) AllocSpace objects, 17(1168KB) LOS objects, 75% free, 11MB/45MB, paused 61us,52us total 71.819ms
2022-10-24 17:04:37.866 26451-26462 StrictMode org.mozilla.fenix.debug D
StrictMode policy violation: android.os.strictmode.LeakedClosableViolation: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
at android.os.StrictMode$AndroidCloseGuardReporter.report(StrictMode.java:1986)
at dalvik.system.CloseGuard.warnIfOpen(CloseGuard.java:336)
at android.view.Surface.finalize(Surface.java:310)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:319)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:306)
at java.lang.Daemons$Daemon.run(Daemons.java:140)
at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.Throwable: Explicit termination method 'Surface.release' not called
at dalvik.system.CloseGuard.openWithCallSite(CloseGuard.java:288)
at dalvik.system.CloseGuard.open(CloseGuard.java:257)
at android.view.Surface.setNativeObjectLocked(Surface.java:760)
at android.view.Surface.updateNativeObject(Surface.java:599)
at android.view.Surface.copyFrom(Surface.java:626)
at android.view.Surface.<init>(Surface.java:268)
at org.mozilla.gecko.gfx.SurfaceControlManager.getChildSurface(SurfaceControlManager.java:76)
at org.mozilla.geckoview.GeckoSession$Compositor.syncResumeResizeCompositor(Native Method)
at org.mozilla.geckoview.GeckoSession.onSurfaceChanged(GeckoSession.java:6086)
at org.mozilla.geckoview.GeckoDisplay.surfaceChanged(GeckoDisplay.java:149)
at org.mozilla.geckoview.GeckoView$Display.acquire(GeckoView.java:121)
at org.mozilla.geckoview.GeckoView.setSession(GeckoView.java:525)
at mozilla.components.browser.engine.gecko.GeckoEngineView.render(GeckoEngineView.kt:116)
at mozilla.components.feature.session.engine.EngineViewPresenter.renderTab(EngineViewPresenter.kt:89)
at mozilla.components.feature.session.engine.EngineViewPresenter.onTabToRender(EngineViewPresenter.kt:62)
at mozilla.components.feature.session.engine.EngineViewPresenter.access$onTabToRender(EngineViewPresenter.kt:24)
at mozilla.components.feature.session.engine.EngineViewPresenter$start$1$3.emit(EngineViewPresenter.kt:46)
at mozilla.components.feature.session.engine.EngineViewPresenter$start$1$3.emit(EngineViewPresenter.kt:46)
at mozilla.components.support.ktx.kotlinx.coroutines.flow.FlowKt$ifAnyChanged$$inlined$filter$1$2.emit(Emitters.kt:223)
at mozilla.components.feature.session.engine.EngineViewPresenter$start$1$invokeSuspend$$inlined$map$1$2.emit(Emitters.kt:223)
at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:62)
at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Unknown Source:14)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Comment 1•1 year ago
|
||
I see this violation often on Test Lab. I'm not sure if it's related to a crash I sometimes see immediately after.
Typically I'll see the violation, and then something like (e.g, run/logcat)
07-31 12:20:59.884: I/ActivityManager(562): Start proc 10518:org.mozilla.fenix.debug:mozilla.components.lib.crash.CrashHandler/u0a177 for service {org.mozilla.fenix.debug/mozilla.components.lib.crash.handler.CrashHandlerService}
07-31 12:20:59.885: I/Zygote(10518): seccomp disabled by setenforce 0
07-31 12:20:59.886: I/sh.CrashHandle(10518): Late-enabling -Xcheck:jni
07-31 12:20:59.894: I/sh.CrashHandle(10518): Unquickening 12 vdex files!
07-31 12:20:59.896: I/adbd(5773): jdwp connection from 10518
07-31 12:20:59.903: I/sh.CrashHandle(10518): The ClassLoaderContext is a special shared library.
07-31 12:20:59.904: I/Gecko(10423): Exiting due to channel error.
07-31 12:20:59.904: I/Gecko(10145): Exiting due to channel error.
07-31 12:20:59.905: W/InputDispatcher(562): channel '860599e org.mozilla.fenix.debug/org.mozilla.fenix.HomeActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
07-31 12:20:59.905: E/InputDispatcher(562): channel '860599e org.mozilla.fenix.debug/org.mozilla.fenix.HomeActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
07-31 12:20:59.906: I/ActivityManager(562): Process org.mozilla.fenix.debug (pid 10094) has died: fg TOP
07-31 12:20:59.906: I/WindowManager(562): WIN DEATH: Window{860599e u0 org.mozilla.fenix.debug/org.mozilla.fenix.HomeActivity}
07-31 12:20:59.906: W/InputDispatcher(562): Attempted to unregister already unregistered input channel '860599e org.mozilla.fenix.debug/org.mozilla.fenix.HomeActivity (server)'
07-31 12:20:59.908: I/WindowManager(562): WIN DEATH: Window{f90247d u0 org.mozilla.fenix.debug/org.mozilla.fenix.HomeActivity}
07-31 12:20:59.908: W/InputDispatcher(562): Attempted to unregister already unregistered input channel 'f90247d org.mozilla.fenix.debug/org.mozilla.fenix.HomeActivity (server)'
07-31 12:20:59.912: I/Zygote(303): Process 10094 exited cleanly (11)
Of which the app just .. dies .....
Comment 2•1 year ago
|
||
I doubt the warning is related to the crash, but can't say for sure from the logs. Are there any instructions for how to reproduce this locally?
Comment 3•1 year ago
|
||
Over to Andi, this was visible from the org.mozilla.fenix.ui.SmokeTest#verifyBasicNavigationToolbarFunctionality
UI instrumented test. Andi have you seen this locally with that test on the Pixel 2?
Updated•4 months ago
|
Description
•