Poco icon indicating copy to clipboard operation
Poco copied to clipboard

怎么会超时的,如何设置超时时间

Open aogg opened this issue 5 months ago • 1 comments

(请尽量按照下面提示内容填写,有助于我们快速定位和解决问题,感谢配合。否则直接关闭。)

(重要!问题分类)

  • 控件识别、树状结构、poco库报错 -> 此仓库

描述问题bug (简洁清晰得概括一下遇到的问题是什么。或者是报错的traceback信息。) 偶然出现超时

(在这里粘贴traceback或其他报错信息)
[19:40:19][ERROR]<airtest.core.api> Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 722, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 467, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 462, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.6/http/client.py", line 1383, in getresponse
    response.begin()
  File "/usr/local/lib/python3.6/http/client.py", line 320, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.6/http/client.py", line 289, 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:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 450, in send
    timeout=timeout
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 802, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 552, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.6/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 722, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 467, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 462, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.6/http/client.py", line 1383, in getresponse
    response.begin()
  File "/usr/local/lib/python3.6/http/client.py", line 320, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.6/http/client.py", line 289, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/hrpc/transport/http.py", line 24, in send
    timeout=timeout)
  File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 117, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/airtest/cli/runner.py", line 72, in runTest
    exec(compile(code.encode("utf-8"), pyfilepath, 'exec'), self.scope)
  File "/data/script/airtest/qq阅读.air/qq阅读.py", line 552, in <module>
    run_广告()
  File "/data/script/airtest/qq阅读.air/qq阅读.py", line 271, in run_广告
    pos = poco(text='今日已领取15赠币,付费会员再领15赠币').wait(10).exists()
  File "/usr/local/lib/python3.6/site-packages/poco/proxy.py", line 657, in wait
    while not self.exists():
  File "/usr/local/lib/python3.6/site-packages/poco/proxy.py", line 72, in wrapped
    return func(proxy, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/poco/proxy.py", line 774, in exists
    return self.attr('visible')
  File "/usr/local/lib/python3.6/site-packages/poco/proxy.py", line 39, in wrapped
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/poco/proxy.py", line 734, in attr
    nodes = self._do_query(multiple=False)
  File "/usr/local/lib/python3.6/site-packages/poco/proxy.py", line 884, in _do_query
    self._nodes = self.poco.agent.hierarchy.select(self.query, multiple)
  File "/usr/local/lib/python3.6/site-packages/poco/utils/retry.py", line 20, in wrapped
    raise ex
  File "/usr/local/lib/python3.6/site-packages/poco/utils/retry.py", line 15, in wrapped
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/poco/utils/hrpc/hierarchy.py", line 33, in select
    return self.selector.select(query, multiple)
  File "/usr/local/lib/python3.6/site-packages/hrpc/object_proxy.py", line 92, in __call__
    return self._client__.evaluate(self.__call_no_evaluate__(remote_obj_cache, *args))
  File "/usr/local/lib/python3.6/site-packages/hrpc/client.py", line 64, in evaluate
    timeout=None if wait_for_response else 0.3)
  File "/usr/local/lib/python3.6/site-packages/hrpc/transport/http.py", line 27, in send
    raise TransportDisconnected(e)
hrpc.exceptions.TransportDisconnected: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

======================================================================
ERROR: runTest (airtest.cli.runner.AirtestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 722, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 467, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 462, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.6/http/client.py", line 1383, in getresponse
    response.begin()
  File "/usr/local/lib/python3.6/http/client.py", line 320, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.6/http/client.py", line 289, 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:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 450, in send
    timeout=timeout
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 802, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 552, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.6/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 722, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 467, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 462, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.6/http/client.py", line 1383, in getresponse
    response.begin()
  File "/usr/local/lib/python3.6/http/client.py", line 320, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.6/http/client.py", line 289, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/hrpc/transport/http.py", line 24, in send
    timeout=timeout)
  File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 117, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/airtest/cli/runner.py", line 75, in runTest
    six.reraise(*sys.exc_info())
  File "/usr/local/lib/python3.6/site-packages/six.py", line 719, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/airtest/cli/runner.py", line 72, in runTest
    exec(compile(code.encode("utf-8"), pyfilepath, 'exec'), self.scope)
  File "/data/script/airtest/qq阅读.air/qq阅读.py", line 552, in <module>
    run_广告()
  File "/data/script/airtest/qq阅读.air/qq阅读.py", line 271, in run_广告
    pos = poco(text='今日已领取15赠币,付费会员再领15赠币').wait(10).exists()
  File "/usr/local/lib/python3.6/site-packages/poco/proxy.py", line 657, in wait
    while not self.exists():
  File "/usr/local/lib/python3.6/site-packages/poco/proxy.py", line 72, in wrapped
    return func(proxy, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/poco/proxy.py", line 774, in exists
    return self.attr('visible')
  File "/usr/local/lib/python3.6/site-packages/poco/proxy.py", line 39, in wrapped
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/poco/proxy.py", line 734, in attr
    nodes = self._do_query(multiple=False)
  File "/usr/local/lib/python3.6/site-packages/poco/proxy.py", line 884, in _do_query
    self._nodes = self.poco.agent.hierarchy.select(self.query, multiple)
  File "/usr/local/lib/python3.6/site-packages/poco/utils/retry.py", line 20, in wrapped
    raise ex
  File "/usr/local/lib/python3.6/site-packages/poco/utils/retry.py", line 15, in wrapped
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/poco/utils/hrpc/hierarchy.py", line 33, in select
    return self.selector.select(query, multiple)
  File "/usr/local/lib/python3.6/site-packages/hrpc/object_proxy.py", line 92, in __call__
    return self._client__.evaluate(self.__call_no_evaluate__(remote_obj_cache, *args))
  File "/usr/local/lib/python3.6/site-packages/hrpc/client.py", line 64, in evaluate
    timeout=None if wait_for_response else 0.3)
  File "/usr/local/lib/python3.6/site-packages/hrpc/transport/http.py", line 27, in send
    raise TransportDisconnected(e)
hrpc.exceptions.TransportDisconnected: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

----------------------------------------------------------------------

复现步骤 偶然出现超时

预期效果 (预期想要得到什么、见到什么) 不超时,或者如何设置超时时间

相关截图 (贴出遇到问题时的截图内容,如果有的话)

python 版本: python3

poco 版本: 1.0.69

poco版本通过pip freeze可以命令可以查到

设备:

  • 型号: [e.g. 红米k30]

其他相关环境信息 (其他运行环境,例如在linux ubuntu16.04上运行异常,在windows上正常。)

aogg avatar Sep 11 '24 12:09 aogg