Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rabbitmq error: [Errno 10054] An existing connection was forcibly closed by the remote host

I am using Kombu in Python to consume a durable RabbitMQ queue.

There is only one consumer consuming the queue in Windows. This consumer produces the below error:

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

There are at most 500 messages in the queue at any one time. Each message is small in size however it is a task and takes up to 10 minutes to complete (although it usually takes less then 5 mins per message).

I have tried restarting the consumer, RabbitMQ server and deleting the queue however the error still persists.

I've seen this question however the answer is from 2010 and my rabbitmq.log has different entries:

=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}}

There were no recent events in the rabbitmq-sasl.log.

Why is this error happening and how can I prevent it from occurring?

like image 468
Greg Avatar asked Apr 25 '16 09:04

Greg


People also ask

Can't start Server Error 10054 An existing connection was forcibly closed by the remote host?

The 10054 error is raised by the Operating System and reports that an existing connection was forcibly closed by the remote host. You should look at the workload on the execution servers at that location and check the Windows event logs for errors or other activity around the time of the failures.

What WinError 10054?

[WinError 10054] An existing connection was forcibly closed by the remote host.


1 Answers

I'm still looking for an answer. In the meantime I restart the connection to my rabbit server:

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')
like image 66
hestellezg Avatar answered Oct 08 '22 17:10

hestellezg