BlockingConnection的connection_workflow.AMQPConnectorStackTimeout

时间:2019-04-29 10:25:27

标签: python pika python-pika

pika BlockingConnection尝试失败(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

1 个答案:

答案 0 :(得分:0)

我又遇到了这个问题,发现了自己的问题:-)

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

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