android-uiautomator-server
android-uiautomator-server copied to clipboard
Unknown RPC error: -32001 java.lang.OutOfMemoryError
Hi, RD,
Hope you are doing well!
Versions:
apk version is __apk_version__ = 2.4.0.
android@Church:/data/ro/uiautomator2/uiautomator2.git$ gl -n2
commit 4157409b2fbb91e204734d3a4ac38c9f79ecb012 (HEAD -> master)
Author: codeskyblue <[email protected]>
Date: Thu Jun 6 14:28:36 2024 +0800
add uibox
============================= test session starts ==============================
platform linux -- Python 3.11.6, pytest-7.4.0, pluggy-1.2.0
rootdir: /data/hmd/camera/camera_test_run
configfile: pytest.ini
testpaths: camera/cases
plugins: hypothesis-6.82.4
collected 6675 items / 6334 deselected / 341 selected
Description: I got OOM , here are my logs:
camera/cases/t1_minimum/test_050_speedwarp_back_camera_restart.py:58:
camera/cameras/hmd/base.py:455: in restart_camera assert open_camera(ulog=ulog) camera/cameras/hmd/base.py:406: in open_camera assert change_dropdown_settings(ulog=ulog, toggle=False) camera/cameras/hmd/base.py:253: in change_dropdown_settings assert toggle_dropdown_settings_by_key(ulog=ulog, key=key, enabled=toggle) camera/cameras/hmd/base.py:218: in toggle_dropdown_settings_by_key with DropdownSettingsWorker(ulog=ulog) as worker: camera/cameras/hmd/base.py:163: in enter if found(ulog=self.ulog, key="more settings closed button"): utils/views.py:75: in wrapper if catch_error(ulog=ulog, witness=key): utils/errors.py:114: in catch_error if not __find_error(ulog, witness): utils/errors.py:52: in __find_error if device(text="Feedback").exists(): uiautomator2/utils.py:100: in call return bool(self) uiautomator2/utils.py:90: in bool return self.nonzero() uiautomator2/utils.py:86: in nonzero return self.uiobject.jsonrpc.exist(self.uiobject.selector) uiautomator2/init.py:184: in call return self.server.jsonrpc_call(self.method, params, http_timeout) uiautomator2/core.py:298: in jsonrpc_call return _jsonrpc_call(self._dev, method, params, timeout, self._debug)
dev = AdbDevice(serial=HH0001VAK0440900380), method = 'exist' params = ({'mask': 1, 'childOrSibling': [], 'childOrSiblingSelector': [], 'text': 'Feedback'},) timeout = 60, print_request = False
def _jsonrpc_call(dev: adbutils.AdbDevice, method: str, params: Any, timeout: float, print_request: bool) -> Any:
"""Send jsonrpc call to uiautomator2 server
Raises:
UiAutomationError
"""
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": method,
"params": params
}
r = _http_request(dev, "POST", "/jsonrpc/0", payload, timeout=timeout, print_request=print_request)
data = r.json()
if not isinstance(data, dict):
raise RPCInvalidError("Unknown RPC error: not a dict")
if isinstance(data, dict) and "error" in data:
logger.debug("jsonrpc error: %s", data)
code = data['error'].get('code')
message = data['error'].get('message', '')
stacktrace = data['error'].get('data')
if "UiAutomation not connected" in r.text:
raise UiAutomationNotConnectedError("UiAutomation not connected")
if "android.os.DeadObjectException" in message:
# https://developer.android.com/reference/android/os/DeadObjectException
raise UiAutomationNotConnectedError("android.os.DeadObjectException")
if "uiautomator.UiObjectNotFoundException" in message:
raise UiObjectNotFoundError(code, message, params)
if "java.lang.StackOverflowError" in message:
raise RPCStackOverflowError(f"StackOverflowError: {message}", params, stacktrace[:1000] + "..." + stacktrace[-1000:])
raise RPCUnknownError(f"Unknown RPC error: {code} {message}", params, stacktrace)
E uiautomator2.exceptions.RPCUnknownError: ('Unknown RPC error: -32001 java.lang.OutOfMemoryError', ({'mask': 1, 'childOrSibling': [], 'childOrSiblingSelector': [], 'text': 'Feedback'},), 'java.lang.OutOfMemoryError: Failed to allocate a 40 byte allocation with 1689360 free bytes and 1649KB until OOM, target footprint 406847488, growth limit 406847488; giving up on allocation because <1% of heap free after GC.\n\tat android.view.accessibility.AccessibilityNodeInfo$CollectionItemInfo$Builder.build(AccessibilityNodeInfo.java:6315)\n\tat android.view.accessibility.AccessibilityNodeInfo.initCopyInfos(AccessibilityNodeInfo.java:4496)\n\tat android.view.accessibility.AccessibilityNodeInfo.init(AccessibilityNodeInfo.java:4471)\n\tat android.view.accessibility.AccessibilityNodeInfo.
uiautomator2/core.py:145: RPCUnknownError
Could you help check it ? Could you help figure out what's root cause? Thank you!