_AsyncBaseTransport._consume() 上的 RabbitMq Pika ConnectionResetError

Sar*_*nan 6 python rabbitmq python-pika

在使用 pika forrabbitmq 的 Flask 应用程序中观察以下错误,

使用pika版本1.1.0rabbitmq版本3.8.5

注意:配置的心跳值是900(由于长时间运行操作而设置了较高的值,所以我必须保持pika和rabbitmq之间的连接处于活动状态)

一段时间后发生连接丢失,我必须重新启动应用程序才能再次连接rabbitmq。有人能指出我到底出了什么问题的正确方向吗!

ERROR:pika.adapters.utils.io_services_utils:_AsyncBaseTransport._consume() failed, aborting connection: error=ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None); sock=<socket.socket fd=556, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 65083), raddr=('0.0.0.0', 5672)>; Caller's stack:
Traceback (most recent call last):
  File "pika\adapters\utils\io_services_utils.py", line 1041, in _on_socket_readable
  File "pika\adapters\utils\io_services_utils.py", line 791, in _consume
  File "pika\adapters\utils\io_services_utils.py", line 79, in retry_sigint_wrap
  File "pika\adapters\utils\io_services_utils.py", line 846, in _sigint_safe_recv
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
Traceback (most recent call last):
  File "pika\adapters\utils\io_services_utils.py", line 1041, in _on_socket_readable
  File "pika\adapters\utils\io_services_utils.py", line 791, in _consume
  File "pika\adapters\utils\io_services_utils.py", line 79, in retry_sigint_wrap
  File "pika\adapters\utils\io_services_utils.py", line 846, in _sigint_safe_recv
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
ERROR:pika.adapters.base_connection:connection_lost: StreamLostError: ("Stream connection lost: ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)",)
ERROR:pika.adapters.blocking_connection:Unexpected connection close detected: StreamLostError: ("Stream connection lost: ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)",)
Run Code Online (Sandbox Code Playgroud)