openatx / uiautomator2

Android Uiautomator2 Python Wrapper
MIT License
6.34k stars 1.37k forks source link

连接两台手机跑10条case,当跑到第4条时就会出现连接失败了ConnectionRefusedError: [Errno 61] Connection refused #254

Closed shixiujuan1203 closed 1 month ago

shixiujuan1203 commented 5 years ago

注,代码或者日志请使用Markdown语法,看完删掉

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/connection.py", line 171, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/util/connection.py", line 79, in create_connection
    raise err
ConnectionRefusedError: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x114979cc0>: Failed to establish a new connection: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/adapters.py", line 445, in send
    timeout=timeout
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 667, in urlopen
    **response_kw)
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=53763): Max retries exceeded with url: /shell (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x114979cc0>: Failed to establish a new connection: [Errno 61] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/uiautomator2/__init__.py", line 280, in request
    method, url, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/sessions.py", line 512, in request
    resp = self.send(prep, **send_kwargs)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=53763): Max retries exceeded with url: /shell (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x114979cc0>: Failed to establish a new connection: [Errno 61] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/shixiujuan/code/autotest/autotest_performance_multiDevices/testCase/test_dy_localtest_013_music_funcs_record.py", line 37, in test_record
    d.app_start("com.ss.android.ugc.aweme", "com.ss.android.ugc.aweme.main.MainActivity")
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/uiautomator2/__init__.py", line 853, in app_start
    self.shell(args)
OSError: atx-agent is not running. Fix it with following steps.
1. Plugin device into computer.
2. Run command "python -m uiautomator2 init"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/shixiujuan/code/autotest/autotest_performance_multiDevices/assistantFunc/assitFuncU2.py", line 34, in wrapper
    func(*args, **kwargs)
  File "/Users/shixiujuan/code/autotest/autotest_performance_multiDevices/testCase/test_dy_localtest_013_music_funcs_record.py", line 93, in test_record
    super().fail(e)
AssertionError: atx-agent is not running. Fix it with following steps.
1. Plugin device into computer.
2. Run command "python -m uiautomator2 init"

Versions (版本)

Version: 0.1.4

Issue and steps to reproduce (复现步骤)

  1. 通过shell脚本启动多进程,每个进程操作一台手机来执行10条case
  2. 每个case中 都有
    def setUp(self): d = u2.connect(devices) d.healthcheck()
  3. 两部手机都启动正常,当执行到第4条case时 两部手机都会出现连接失败情况,具体log如上

Screenshots (相关截图)

能有尽量有

Additional Details (其他信息)

shixiujuan1203 commented 5 years ago

atx-agent.log

shixiujuan1203 commented 5 years ago

u2版本 Version: 0.1.7 也会出现这个问题

codeskyblue commented 5 years ago

日志里面也看不出来啥问题 @shixiujuan, 你看出问题的时候 ps看下 atx-agent 还在运行吗?

cataglyphis commented 5 years ago

从 log 看应该是 atx-agent service不在了,是不是被系统杀死了

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.