最新消息:20210917 已从crifan.com换到crifan.org

【未解决】安卓自动化测试报错:requests.exceptions.ConnectionError Connection aborted RemoteDisconnected Remote end closed connection without response

安卓 crifan 799浏览 0评论
折腾:
【未解决】开启和运行另外一个设备id是1的红米Note8Pro的自动化测试安卓项目环境
期间,之前出现过一次:
[201208 14:10:51][DownloadApps.py 139] download com.netease.index.vivo/魔法禁书目录 speed: cur=3.3MB/s, time: total=00:03:36, size: 680.0MB 34.62%
Traceback (most recent call last):
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/urllib3/contrib/pyopenssl.py", line 313, in recv_into
    return self.connection.recv_into(*args, **kwargs)
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/OpenSSL/SSL.py", line 1822, in recv_into
    self._raise_ssl_error(self._ssl, result)
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/OpenSSL/SSL.py", line 1639, in _raise_ssl_error
    raise SysCallError(errno, errorcode.get(errno))
OpenSSL.SSL.SysCallError: (54, 'ECONNRESET')


During handling of the above exception, another exception occurred:


Traceback (most recent call last):
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/urllib3/response.py", line 425, in _error_catcher
    yield
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/urllib3/response.py", line 507, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "/Users/xxx/.pyenv/versions/3.8.0/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 454, in read
    n = self.readinto(b)
  File "/Users/xxx/.pyenv/versions/3.8.0/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 498, in readinto
    n = self.fp.readinto(b)
  File "/Users/xxx/.pyenv/versions/3.8.0/Python.framework/Versions/3.8/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/urllib3/contrib/pyopenssl.py", line 318, in recv_into
    raise SocketError(str(e))
OSError: (54, 'ECONNRESET')
。。。
During handling of the above exception, another exception occurred:


Traceback (most recent call last):
  File "crawlerStart.py", line 201, in <module>
    scheduler.start()
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/src/AppCrawler.py", line 55, in start
    self.check_download(task)
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/src/common/DownloadApps.py", line 21, in check_download
    self.download(task)
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/src/common/DownloadApps.py", line 113, in download
    for chunkBytes in r.iter_content(chunk_size=ChunkSize):
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/requests/models.py", line 753, in generate
    raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ('Connection broken: OSError("(54, \'ECONNRESET\')")', OSError("(54, 'ECONNRESET')"))
貌似是公司网络不稳定??
只能重试。
但是后续又遇到了:
201208 14:45:31][AppCrawler.py 77 ] start to crawl app 0 com.hero.lszt.vivo_绿色征途 com.hero.lszt.vivo, remain 9
[201208 14:45:31][DevicesMethods.py 4064] start to install app in 20201208_fengyun_ViVoGameMoYuSecondTen_gameApp_Android.txt
[201208 14:45:31][DevicesMethods.py 4112] Run length=255, command: adb -s hmucaei75ptk7szs install -r -f /Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/task/20201208_fengyun_ViVoGameMoYuSecondTen/20201208_fengyun_ViVoGameMoYuSecondTen_gameApp_Android/20201208_fengyun_ViVoGameMoYuSecondTen_gameApp_Android_0.apk
Performing Streamed Install
[D 201208 14:45:33 __init__:600] kill process(ps): uiautomator
[D 201208 14:45:34 __init__:618] uiautomator-v2 is starting ... left: 40.0s
[D 201208 14:45:35 __init__:618] uiautomator-v2 is starting ... left: 39.0s
[D 201208 14:45:36 __init__:618] uiautomator-v2 is starting ... left: 38.0s
[I 201208 14:45:36 __init__:583] uiautomator back to normal
adb: failed to install /Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/task/20201208_fengyun_ViVoGameMoYuSecondTen/20201208_fengyun_ViVoGameMoYuSecondTen_gameApp_Android/20201208_fengyun_ViVoGameMoYuSecondTen_gameApp_Android_0.apk: [I 201208 14:45:36 __init__:258] USB disconnected, fallback to WiFi, ATX_AGENT_URL=http://192.168.31.177:7912
Exception in thread watcher:
Traceback (most recent call last):
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "/Users/xxx/.pyenv/versions/3.8.0/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1322, in getresponse
    response.begin()
  File "/Users/xxx/.pyenv/versions/3.8.0/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 303, in begin
    version, status, reason = self._read_status()
  File "/Users/xxx/.pyenv/versions/3.8.0/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 272, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response


During handling of the above exception, another exception occurred:

。。。
During handling of the above exception, another exception occurred:


Traceback (most recent call last):
  File "/Users/xxx/.pyenv/versions/3.8.0/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/Users/xxx/.pyenv/versions/3.8.0/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/uiautomator2/watcher.py", line 225, in _watch_forever
    triggered = self.run()
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/uiautomator2/watcher.py", line 237, in run
    return self._run_watchers(source=source)
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/uiautomator2/watcher.py", line 244, in _run_watchers
    source = source or self._dump_hierarchy()
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/uiautomator2/watcher.py", line 173, in _dump_hierarchy
    return self._d.dump_hierarchy()
  File "</Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/decorator.py:decorator-gen-12>", line 2, in dump_hierarchy
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/retry/api.py", line 73, in retry_decorator
    return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/retry/api.py", line 33, in __retry_internal
    return f()
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/uiautomator2/__init__.py", line 894, in dump_hierarchy
    return decodedImage
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/uiautomator2/__init__.py", line 435, in __call__
    return self.server._jsonrpc_retry_call(self.method, params,
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/uiautomator2/__init__.py", line 451, in _jsonrpc_retry_call
    return self._jsonrpc_call(*args, **kwargs)
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/uiautomator2/__init__.py", line 471, in _jsonrpc_call
    res = self.http.post("/jsonrpc/0",
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/requests/sessions.py", line 581, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/uiautomator2/__init__.py", line 188, in request
    return super().request(method, url, **kwargs)
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/uiautomator2/__init__.py", line 108, in request
    resp = super(TimeoutRequestsSession,
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/Users/xxx/dev/xxx/crawler/appAutoCrawler/AppCrawler/venv/lib/python3.8/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
这个貌似是网络问题?
估计重试即可。
但是貌似感觉又不是 不仅仅是 网络不稳定导致的?
目前问题还是没彻底解决。
暂不能完全肯定之前是公司网络不稳定导致的此处问题。
不能完全排除,是否和此处的uiautomator2有关。

转载请注明:在路上 » 【未解决】安卓自动化测试报错:requests.exceptions.ConnectionError Connection aborted RemoteDisconnected Remote end closed connection without response

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
90 queries in 0.201 seconds, using 23.35MB memory