appium-espresso-driver: Server crash with OOM
While trying Espresso on one of our app, on a screens which have a lot of elements in the hierarchy, finding by XPath brings down Espresso server with Out Of Memory. The Xpath was {:xpath=>"//*[@text='Loading...']"}
.
Same thing happens when I try to get page source on that screen
--------- beginning of crash
12-11 16:36:04.147 28992 29515 E AndroidRuntime: FATAL EXCEPTION: NanoHttpd Request Processor (#20)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: Process: com.bumble.app, PID: 28992
12-11 16:36:04.147 28992 29515 E AndroidRuntime: java.lang.OutOfMemoryError: Failed to allocate a 268501000 byte allocation with 6291456 free bytes and 179MB until OOM, max allowed footprint 153800280, growth limit 335544320
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at java.util.Arrays.copyOf(Arrays.java:3260)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:125)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:605)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at java.lang.StringBuffer.append(StringBuffer.java:367)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at java.io.StringWriter.write(StringWriter.java:94)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at org.kxml2.io.KXmlSerializer.flushBuffer(KXmlSerializer.java:80)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at org.kxml2.io.KXmlSerializer.append(KXmlSerializer.java:53)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at org.kxml2.io.KXmlSerializer.attribute(KXmlSerializer.java:496)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.model.SourceDocument.serializeView(SourceDocument.java:172)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.model.SourceDocument.serializeView(SourceDocument.java:179)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.model.SourceDocument.serializeView(SourceDocument.java:179)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.model.SourceDocument.serializeView(SourceDocument.java:179)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.model.SourceDocument.serializeView(SourceDocument.java:179)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.model.SourceDocument.serializeView(SourceDocument.java:179)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.model.SourceDocument.serializeView(SourceDocument.java:179)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.model.SourceDocument.toXMLString(SourceDocument.java:197)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.model.SourceDocument.findViewsByXPath(SourceDocument.java:212)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.viewmatcher.WithXPath.withXPath(WithXPath.java:35)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.viewmatcher.WithXPath.withXPath(WithXPath.java:57)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.helpers.ViewFinder.findAllBy(ViewFinder.java:180)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.helpers.ViewFinder.findAllBy(ViewFinder.java:113)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.handlers.FindElements.handle(FindElements.java:48)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.handlers.FindElements.handle(FindElements.java:33)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.http.Router.route(Router.java:296)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at io.appium.espressoserver.lib.http.Server.serve(Server.java:68)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)
12-11 16:36:04.147 28992 29515 E AndroidRuntime: at java.lang.Thread.run(Thread.java:764)
12-11 16:36:04.188 1373 1373 E SELinux : avc: denied { find } for interface=android.hardware.memtrack::IMemtrack pid=28992 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:hal_memtrack_hwservice:s0 tclass=hwservice_manager
12-11 16:36:04.188 28992 29515 E memtrack: Couldn't load memtrack module
12-11 16:36:04.189 28992 29515 W android.os.Debug: failed to get memory consumption info: -1
12-11 16:36:04.197 28992 29515 I Process : Sending signal. PID: 28992 SIG: 9
12-11 16:36:04.326 1700 12120 I WindowManager: WIN DEATH: Window{3882189 u0 com.bumble.app/com.bumble.app.ui.main.AppMainActivity}
12-11 16:36:04.328 1700 13524 D ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [ LISTEN id=39, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND] ], android.os.BinderProxy@56111c6)
12-11 16:36:04.328 1700 5090 I ActivityManager: Process com.bumble.app (pid 28992) has died: fore TOP
12-11 16:36:04.332 1700 5090 W ActivityManager: Force removing ActivityRecord{2eac9c7 u0 com.bumble.app/.ui.main.AppMainActivity t317}: app died, no saved state
12-11 16:36:04.334 29043 29043 I cr_ChildProcessService: Destroying ChildProcessService pid=29043
12-11 16:36:04.339 29043 29043 I /system/bin/webview_zygote32: System.exit called, status: 0
12-11 16:36:04.339 29043 29043 I AndroidRuntime: VM exiting with result code 0, cleanup skipped.
12-11 16:36:04.339 1700 1788 E ConnectivityService: RemoteException caught trying to send a callback msg for NetworkRequest [ LISTEN id=39, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND] ]
12-11 16:36:04.352 1700 5090 W ActivityManager: Crash of app com.bumble.app running instrumentation ComponentInfo{io.appium.espressoserver.test/androidx.test.runner.AndroidJUnitRunner}
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (10 by maintainers)
Published the fix in 1.5.0
@dpgraham I think the problem there is the same as it was for UIA2. We should simply limit the maximum depth of views hierarchy traversal. I’ll prepare a hot fix soon