lamda异常_InactiveRpcError

grpc._channel._InactiveRpcError:failed to connect to all addresses; last error: UNAVAILABLE: WSA Error

adb forward tcp:8123 tcp:8123 因为forward转发端口不稳定,导致grpc链接不上导致出现以下错误

 File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\lamda\client.py", line 436, in exists
    r = self.stub.selectorExists(req)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_interceptor.py", line 216, in __call__
    response, ignored_call = self._with_call(request,
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_interceptor.py", line 257, in _with_call
    return call.result(), call
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_channel.py", line 343, in result
    raise self
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_interceptor.py", line 241, in continuation
    response, call = self._thunk(new_method).with_call(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_interceptor.py", line 266, in with_call
    return self._with_call(request,
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_interceptor.py", line 257, in _with_call
    return call.result(), call
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_channel.py", line 343, in result
    raise self
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_interceptor.py", line 241, in continuation
    response, call = self._thunk(new_method).with_call(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_interceptor.py", line 266, in with_call
    return self._with_call(request,
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_interceptor.py", line 257, in _with_call
    return call.result(), call
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_channel.py", line 343, in result
    raise self
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_interceptor.py", line 241, in continuation
    response, call = self._thunk(new_method).with_call(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_channel.py", line 957, in with_call
    return _end_unary_response_blocking(state, call, True, None)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\grpc\_channel.py", line 849, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNAVAILABLE
        details = "failed to connect to all addresses; last error: UNAVAILABLE: WSA Error"
        debug_error_string = "UNKNOWN:Failed to pick subchannel {created_time:"2024-01-24T02:39:13.747574993+00:00", children:[UNKNOWN:failed to connect to all addresses; last error: UNAVAILABLE: WSA Error {created_time:"2024-01-24T02:39:13.74756812+00:00", grpc_status:14}]}"

解决方法

可能手机或模拟机卡死的,需要重启,重新开启

如果手机模拟器正常运行,但是还是无法链接的,可以通过

adb connect 127.0.0.1:62001

重新链接模拟器和端口(我的是夜神模拟器,所以是62001,其他的自行参考)

adb forward tcp:8123 tcp:8123

并重新转发端口

就可以了!!!

另附上:

Python程序运行cmd命令连接方法

commands = [
    'adb connect 127.0.0.1:62001',
    'adb forward tcp:8123 tcp:8123',
]
for cmd in commands:
    print(subprocess.run(cmd, shell=True))

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐