alibaba / alibaba/tidevice

多次launch会导致timeout,The handshake operation timed out

Open
#332 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.6k
Forks
469
PR merge metrics
No merged PRs in 30d

Description

我尝试使用com.apple.springboard亮屏,自动化测试在大约经过400条的测试用例后,会出现如下错误,需要重启手机

C:\Users\wjw>tidevice launch com.apple.springboard
Traceback (most recent call last):
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\Scripts\tidevice.exe\__main__.py", line 7, in <module>
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\site-packages\tidevice\__main__.py", line 978, in main
    actions[args.subparser](args)
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\site-packages\tidevice\__main__.py", line 341, in cmd_launch
    with d.connect_instruments() as ts:
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\site-packages\decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\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 "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\site-packages\retry\api.py", line 33, in __retry_internal
    return f()
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\site-packages\tidevice\_device.py", line 818, in connect_instruments
    conn = self.start_service(
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\site-packages\tidevice\_device.py", line 502, in start_service
    return self._unsafe_start_service(name)
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\site-packages\tidevice\_device.py", line 541, in _unsafe_start_service
    conn = self.create_inner_connection(data['Port'], _ssl=_ssl, ssl_dial_only=ssl_dial_only)
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\site-packages\tidevice\_device.py", line 292, in create_inner_connection
    psock.switch_to_ssl(self.ssl_pemfile_path)
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\site-packages\tidevice\_safe_socket.py", line 162, in switch_to_ssl
    ssock = context.wrap_socket(self._sock, server_hostname="iphone.localhost")
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1071, in _create
    self.do_handshake()
  File "C:\Users\wjw\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1342, in do_handshake
    self._sslobj.do_handshake()
TimeoutError: _ssl.c:980: The handshake operation timed out

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing repeated tidevice launch com.apple.springboard calls and inspect the traceback path through tidevice/_device.py (connect_instruments, start_service) and tidevice/_safe_socket.py (switch_to_ssl). Determine why the SSL handshake times out after many launches; done means the repeated automation run no longer requires a device restart or the failure is reported with a reliable recovery path.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, python
Domain
cli, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.