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

Appium UiAutomator2 StackOverFlow from infinite recursion #12545

Closed
dicksonch opened this issue Apr 25, 2019 · 3 comments
Closed

Appium UiAutomator2 StackOverFlow from infinite recursion #12545

dicksonch opened this issue Apr 25, 2019 · 3 comments
Labels
UIAutomator2 specific to uiautomator2 driver

Comments

@dicksonch
Copy link

dicksonch commented Apr 25, 2019

The problem

Inspecting elements using Appium inspector/finding elements with xpath/ clicking elements causes Appium to fall into infinite recursion (specifically, appium-uiautomator2-server). However, finding elements by class name and by id works fine. Appium only exhibits this behaviour with a particular page in the page, the other pages function normally. UiAutomator1 was used as well and behaves normally.

Environment

  • Appium version (or git revision) that exhibits the issue: Appium 1.12.1 UiAutomator2
  • Desktop OS/version used to run Appium: Windows 10
  • Mobile platform/version under test: Android 9
  • Real device or emulator/simulator: Real device ( Huawei, Samsung)
  • Appium CLI or Appium.app|exe: Appium.exe

Details

The stack seems to suggest that AccessibilityNodeInfoHelpers.getVisibleBounds will cause an infinite loop of UiAutomationElement. -> UiAutomationElement.getOrCreateElement -> UiAutomationElement.buildChildren. until it causes a StackOverflowError.

The fact that elements can be found via id but as soon as I try to do anything to do with display like .click(), the error occurs seems to suggest the same thing.

Fatal error while handling action in: io.appium.uiautomator2.handler.Source
java.lang.StackOverflowError: stack size 1041KB
at android.app.WindowConfiguration.setAppBounds(WindowConfiguration.java:332)
at android.app.WindowConfiguration.setAppBounds(WindowConfiguration.java:319)
at android.app.WindowConfiguration.setTo(WindowConfiguration.java:388)
at android.content.res.Configuration.setTo(Configuration.java:1136)
at android.content.res.Configuration.(Configuration.java:1091)
at android.view.DisplayAdjustments.(DisplayAdjustments.java:36)
at android.view.Display.(Display.java:444)
at android.view.Display.(Display.java:434)
at android.hardware.display.DisplayManagerGlobal.getCompatibleDisplay (DisplayManagerGlobal.java:276)
at android.app.ResourcesManager.getAdjustedDisplay(ResourcesManager.java:328)
at android.app.ContextImpl.getDisplay(ContextImpl.java:2441)
at android.view.WindowManagerImpl.getDefaultDisplay(WindowManagerImpl.java:147)
at androidx.test.uiautomator.UiDevice.getDefaultDisplay(UiDevice.java:1090)
at androidx.test.uiautomator.UiDevice.getDisplayWidth(UiDevice.java:524)
at io.appium.uiautomator2.core.AccessibilityNodeInfoHelpers.getVisibleBounds (AccessibilityNodeInfoHelpers.java:96)
at io.appium.uiautomator2.model.UiAutomationElement. (UiAutomationElement.java:85)
at io.appium.uiautomator2.model.UiAutomationElement.getOrCreateElement (UiAutomationElement.java:127)
at io.appium.uiautomator2.model.UiAutomationElement.buildChildren (UiAutomationElement.java:165)
at io.appium.uiautomator2.model.UiAutomationElement. (UiAutomationElement.java:89)
at io.appium.uiautomator2.model.UiAutomationElement.getOrCreateElement (UiAutomationElement.java:127)
at io.appium.uiautomator2.model.UiAutomationElement.buildChildren (UiAutomationElement.java:165)
at io.appium.uiautomator2.model.UiAutomationElement. (UiAutomationElement.java:89)
at io.appium.uiautomator2.model.UiAutomationElement.getOrCreateElement (UiAutomationElement.java:127)
at io.appium.uiautomator2.model.UiAutomationElement.buildChildren (UiAutomationElement.java:165)
at io.appium.uiautomator2.model.UiAutomationElement. (UiAutomationElement.java:89)

Link to Appium logs

Appium Log
Line 157 shows the infinite recursion.
adb logcat

Both of the logs show the StackOverFlow Error that is very likely the cause of the issue.
Please, any hint is greatly appreciated.

@mykola-mokhnach mykola-mokhnach added the UIAutomator2 specific to uiautomator2 driver label Apr 25, 2019
@mykola-mokhnach
Copy link
Collaborator

This looks more like an Android/Application issue, however we could add a workaround and hard-limit the recursion depth for this method

@mykola-mokhnach
Copy link
Collaborator

The workaround has been published in appium@beta

@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
UIAutomator2 specific to uiautomator2 driver
Projects
None yet
Development

No branches or pull requests

2 participants