gpt4 book ai didi

python - Rabbitmq错误: [Errno 10054] An existing connection was forcibly closed by the remote host

转载 作者:太空狗 更新时间:2023-10-29 19:29:54 27 4
gpt4 key购买 nike

我在 Python 中使用 Kombu 来使用持久的 RabbitMQ 队列。

Windows 中只有一个消费者在消费队列。此消费者产生以下错误:

Traceback (most recent call last):
File ".\consumer_windows.py", line 66, in <module>
message.ack()
File "C:\Users\Administrator\Anaconda2\lib\site-packages\kombu\message.py", line 88, in ack
self.channel.basic_ack(self.delivery_tag)
File "C:\Users\Administrator\Anaconda2\lib\site-packages\amqp\channel.py", line 1584, in basic_ack
self._send_method((60, 80), args)
File "C:\Users\Administrator\Anaconda2\lib\site-packages\amqp\abstract_channel.py", line 56, in _send_method
self.channel_id, method_sig, args, content,
File "C:\Users\Administrator\Anaconda2\lib\site-packages\amqp\method_framing.py", line 221, in write_method
write_frame(1, channel, payload)
File "C:\Users\Administrator\Anaconda2\lib\site-packages\amqp\transport.py", line 182, in write_frame
frame_type, channel, size, payload, 0xce,
File "C:\Users\Administrator\Anaconda2\lib\socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
error: [Errno 10054] An existing connection was forcibly closed by the remote host

任一时刻队列中最多有 500 条消息。每条消息都很小,但它是一项任务,最多需要 10 分钟才能完成(尽管每条消息通常需要不到 5 分钟)。

我已尝试重新启动消费者、RabbitMQ 服务器并删除队列,但错误仍然存​​在。

我看过 this question然而the answer来自 2010 年,我的 rabbitmq.log 有不同的条目:

=ERROR REPORT==== 24-Apr-2016::08:26:20 ===
closing AMQP connection <0.6716.384> (192.168.X.X:59602 -> 192.168.Y.X:5672):
{writer,send_failed,{error,timeout}}

rabbitmq-sasl.log 中没有最近的事件。

为什么会发生此错误以及如何防止它发生?

最佳答案

我还在寻找答案。与此同时,我重新启动与我的兔子服务器的连接:

while True:
try:

connection = pika.BlockingConnection(params)
channel = connection.channel() # start a channel
channel.queue_declare(queue=amqp_q, durable=True) # Declare a queue
...

except pika.exceptions.ConnectionClosed:
print('connection closed... and restarted')

关于python - Rabbitmq错误: [Errno 10054] An existing connection was forcibly closed by the remote host,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36836937/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com