connection_workflow.AMQPConnectorStackTimeout from BlockingC



pika 阻塞连接尝试失败(pika 版本 1.0.0(。应用程序日志中显示的异常 - adapters.utils.connection_workflow.AMQPConnectorStackTimeout - 似乎不是pika.exceptions中的任何异常。

pika 不是应该在将此类内部异常转换为pika.exceptions中的异常之一,然后再将其呈现给调用方吗?

如果没有,我应该如何枚举 pika 可能引发的所有可能的异常,以便我可以决定调用方可以处理哪些以及它不应该尝试处理哪些?(实质上,调用方需要决定是退出不可恢复的异常,还是在条件可能是暂时性时重试。

也许我误解了应用程序日志,如下所示:

2019-04-26T11:33:29.880310567Z ERROR:pika.adapters.utils.connection_workflow:Timeout while setting up AMQP to '█.█.█.█'/(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '█.█.█.█', ('█.█.█.█', ████)); ssl=False
2019-04-26T11:33:29.880880966Z ERROR:pika.adapters.utils.connection_workflow:AMQPConnector - reporting failure: AMQPConnectorAMQPHandshakeError: AMQPConnectorStackTimeout("Timeout during AMQP handshake'█.█.█.█'/(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '█.█.█.█', ('█.█.█.█', █)); ssl=False",)
2019-04-26T11:33:29.881053365Z ERROR:pika.adapters.utils.connection_workflow:AMQP connection workflow failed: AMQPConnectionWorkflowFailed: 1 exceptions in all; last exception - AMQPConnectorAMQPHandshakeError: AMQPConnectorStackTimeout("Timeout during AMQP handshake'█.█.█.█'/(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '█.█.█.█', ('█.█.█.█', ████)); ssl=False",); first exception - None.
2019-04-26T11:33:29.881150165Z ERROR:pika.adapters.utils.connection_workflow:AMQPConnectionWorkflow - reporting failure: AMQPConnectionWorkflowFailed: 1 exceptions in all; last exception - AMQPConnectorAMQPHandshakeError: AMQPConnectorStackTimeout("Timeout during AMQP handshake'█.█.█.█'/(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '█.█.█.█', ('█.█.█.█', ████)); ssl=False",); first exception - None
2019-04-26T11:33:29.881503064Z ERROR:pika.adapters.blocking_connection:Connection workflow failed: AMQPConnectionWorkflowFailed: 1 exceptions in all; last exception - AMQPConnectorAMQPHandshakeError: AMQPConnectorStackTimeout("Timeout during AMQP handshake'█.█.█.█'/(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '█.█.█.█', ('█.█.█.█', ████)); ssl=False",); first exception - None
2019-04-26T11:33:29.882705661Z ERROR:pika.adapters.blocking_connection:Error in _create_connection().
2019-04-26T11:33:29.882720061Z Traceback (most recent call last):
2019-04-26T11:33:29.882724561Z   File "/usr/lib/python3.6/site-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
2019-04-26T11:33:29.882728961Z     raise self._reap_last_connection_workflow_error(error)
2019-04-26T11:33:29.882732761Z pika.adapters.utils.connection_workflow.AMQPConnectorStackTimeout: Timeout during AMQP handshake'█.█.█.█'/(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '█.█.█.█', ('█.█.█.█', ████)); ssl=False
2019-04-26T11:33:29.883257859Z ERROR:root:AMQPConnectorStackTimeout Timeout during AMQP handshake'█.█.█.█'/(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '█.█.█.█', ('█.█.█.█', ████)); ssl=False
2019-04-26T11:33:29.883273859Z Traceback (most recent call last):
2019-04-26T11:33:29.883278359Z   File "main.py", line 143, in <module>
2019-04-26T11:33:29.883282559Z     main()
2019-04-26T11:33:29.883286259Z   File "main.py", line 118, in main
2019-04-26T11:33:29.883290059Z     with pika.BlockingConnection(parameters=pika.URLParameters(██████████)) as connection:
2019-04-26T11:33:29.883293959Z   File "/usr/lib/python3.6/site-packages/pika/adapters/blocking_connection.py", line 360, in __init__
2019-04-26T11:33:29.883307559Z     self._impl = self._create_connection(parameters, _impl_class)
2019-04-26T11:33:29.883311659Z   File "/usr/lib/python3.6/site-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
2019-04-26T11:33:29.883315459Z     raise self._reap_last_connection_workflow_error(error)
2019-04-26T11:33:29.883319059Z pika.adapters.utils.connection_workflow.AMQPConnectorStackTimeout: Timeout during AMQP handshake'█.█.█.█'/(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '█.█.█.█', ('█.█.█.█', ████)); ssl=False
2019-04-26T11:33:29.883323159Z Traceback (most recent call last):
2019-04-26T11:33:29.883326759Z   File "main.py", line 143, in <module>
2019-04-26T11:33:29.883465559Z     main()
2019-04-26T11:33:29.883473059Z   File "main.py", line 118, in main
2019-04-26T11:33:29.883635558Z     with pika.BlockingConnection(parameters=pika.URLParameters(██████████)) as connection:
2019-04-26T11:33:29.883650458Z   File "/usr/lib/python3.6/site-packages/pika/adapters/blocking_connection.py", line 360, in __init__
2019-04-26T11:33:29.883894657Z     self._impl = self._create_connection(parameters, _impl_class)
2019-04-26T11:33:29.883902657Z   File "/usr/lib/python3.6/site-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
2019-04-26T11:33:29.884212657Z     raise self._reap_last_connection_workflow_error(error)
2019-04-26T11:33:29.884222357Z pika.adapters.utils.connection_workflow.AMQPConnectorStackTimeout: Timeout during AMQP handshake'█.█.█.█'/(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '█.█.█.█', ('█.█.█.█', ████)); ssl=False

我再次遇到这个问题并找到了我自己的问题:-(

文档似乎有点缺乏,但是pika.adapters.utils.connection_workflow中有一个完整的异常层次结构,其基类是AMQPConnectorException

答案似乎是浏览此模块源代码以查看应处理哪些异常。

相关内容

  • 没有找到相关文章

最新更新