【发布时间】:2021-05-02 20:52:02
【问题描述】:
我有一个在多线程环境中使用的 asyncio gRPC 客户端。当多个线程同时通过客户端连接到服务时,我看到以下错误流:
2021-01-27 09:33:56,937 错误 [asyncio] [thread_0] 回调 PollerCompletionQueue._handle_events()() 中的异常 句柄:)()> 回溯(最近一次通话最后): _run 中的文件“/usr/local/lib/python3.8/asyncio/events.py”,第 81 行 self._context.run(self._callback, *self._args) 文件“src/python/grpcio/grpc/_cython/_cygrpc/aio/completion_queue.pyx.pxi”,第 147 行,在 grpc._cython.cygrpc.PollerCompletionQueue._handle_events BlockingIOError: [Errno 11] 资源暂时不可用 2021-01-27 09:33:56,937 错误 [asyncio] [thread_1] 回调 PollerCompletionQueue._handle_events()() 中的异常 句柄:)()> 回溯(最近一次通话最后): _run 中的文件“/usr/local/lib/python3.8/asyncio/events.py”,第 81 行 self._context.run(self._callback, *self._args) 文件“src/python/grpcio/grpc/_cython/_cygrpc/aio/completion_queue.pyx.pxi”,第 147 行,在 grpc._cython.cygrpc.PollerCompletionQueue._handle_events BlockingIOError: [Errno 11] 资源暂时不可用请求似乎成功完成,但是,消息充斥着我的日志,让我感到紧张!
在我的测试中,每个线程都创建自己的通道并提交自己的异步请求。无论服务负载如何,都会发生错误。如果客户端在不同的进程中运行,则不会发生错误。
我的设置:
- Python 版本:
3.8.6 -
grpcio版本:1.35.0
感谢任何见解!
【问题讨论】:
标签: python python-asyncio grpc python-multithreading grpc-python