Skip to content

Celery 4 worker can't connect to RabbitMQ broker failover #3921

Closed

Description

@draskomikic

I have 3 RabbitMQ nodes in cluster in HA mode. Each node is on separate Docker container.

I have used this command to set HA policy:
rabbitmqctl set_policy ha-all "" '{"ha-mode":"all","ha-sync-mode":"automatic"}'

Celery config looks like this:

CELERY = dict(
    broker_url=[
        'amqp://guest@rabbitmq1:5672',
        'amqp://guest@rabbitmq2:5672',
        'amqp://guest@rabbitmq3:5672',
    ],
    celery_queue_ha_policy='all',
    accept_content=['json'],
    task_serializer='json',
    result_serializer='json',
    task_default_queue='default',
    task_queues=(
        Queue('default', Exchange('default')),
        Queue('preprocessor', Exchange('preprocessor')),
        Queue('vcp', Exchange('vcp')),
        Queue('alpha', Exchange('alpha')),
    ),
    task_routes={
        'myapp.worker.tasks.preprocess': {'queue': 'preprocessor'},
        'myapp.worker.tasks.vcp': {'queue': 'vcp'},
         'myapp.worker.tasks.alpha': {'queue': 'alpha'},
    },
    imports=[
        'myapp.worker.tasks',
    ]
)

Everything works fine until I stop master RabbitMQ application in order to test Celery failover feature using command:
rabbitmqctl stop_app

Immediately after RabbitMQ application is stopped I started seeing errors in log bellow. Frequency of log messages is very high and it doesn't slow down with number of attempts.

According to logs Celery tries to reconnect using next failover but it get interrupted by another try to reconnect to node that was stopped. The same thing happens over and over like in infinite loop.

[2017-03-17 15:10:28,084: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@rabbitmq1:5672//: [Errno 111] Connection refused.
Will retry using next failover.

[2017-03-17 15:10:28,300: DEBUG/MainProcess] Start from server, version: 0.9, properties: {'information': 'Licensed under the MPL.  See http://www.rabbitmq.com/', 'product': 'RabbitMQ', 'copyright': 'Copyright (C) 2007-2016 Pivotal Software, Inc.', 'capabilities': {'exchange_exchange_bindings': True, 'connection.blocked': True, 'authentication_failure_close': True, 'direct_reply_to': True, 'basic.nack': True, 'per_consumer_qos': True, 'consumer_priorities': True, 'consumer_cancel_notify': True, 'publisher_confirms': True}, 'cluster_name': 'rabbit@rabbitmq1', 'platform': 'Erlang/OTP', 'version': '3.6.6'}, mechanisms: [u'PLAIN', u'AMQPLAIN'], locales: [u'en_US']
[2017-03-17 15:10:28,302: DEBUG/MainProcess] ^-- substep ok
[2017-03-17 15:10:28,303: DEBUG/MainProcess] | Consumer: Starting Mingle
[2017-03-17 15:10:28,303: INFO/MainProcess] mingle: searching for neighbors
[2017-03-17 15:10:28,303: DEBUG/MainProcess] using channel_id: 1
[2017-03-17 15:10:28,318: DEBUG/MainProcess] Channel open
[2017-03-17 15:10:28,470: WARNING/MainProcess] consumer: Connection to broker lost. Trying to re-establish the connection...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/celery/worker/consumer/consumer.py", line 318, in start
    blueprint.start(self)
  File "/usr/local/lib/python2.7/site-packages/celery/bootsteps.py", line 119, in start
    step.start(parent)
  File "/usr/local/lib/python2.7/site-packages/celery/worker/consumer/mingle.py", line 38, in start
    self.sync(c)
  File "/usr/local/lib/python2.7/site-packages/celery/worker/consumer/mingle.py", line 42, in sync
    replies = self.send_hello(c)
  File "/usr/local/lib/python2.7/site-packages/celery/worker/consumer/mingle.py", line 55, in send_hello
    replies = inspect.hello(c.hostname, our_revoked._data) or {}
  File "/usr/local/lib/python2.7/site-packages/celery/app/control.py", line 129, in hello
    return self._request('hello', from_node=from_node, revoked=revoked)
  File "/usr/local/lib/python2.7/site-packages/celery/app/control.py", line 81, in _request
    timeout=self.timeout, reply=True,
  File "/usr/local/lib/python2.7/site-packages/celery/app/control.py", line 436, in broadcast
    limit, callback, channel=channel,
  File "/usr/local/lib/python2.7/site-packages/kombu/pidbox.py", line 315, in _broadcast
    serializer=serializer)
  File "/usr/local/lib/python2.7/site-packages/kombu/pidbox.py", line 290, in _publish
    serializer=serializer,
  File "/usr/local/lib/python2.7/site-packages/kombu/messaging.py", line 181, in publish
    exchange_name, declare,
  File "/usr/local/lib/python2.7/site-packages/kombu/messaging.py", line 187, in _publish
    channel = self.channel
  File "/usr/local/lib/python2.7/site-packages/kombu/messaging.py", line 209, in _get_channel
    channel = self._channel = channel()
  File "/usr/local/lib/python2.7/site-packages/kombu/utils/functional.py", line 38, in __call__
    value = self.__value__ = self.__contract__()
  File "/usr/local/lib/python2.7/site-packages/kombu/messaging.py", line 224, in <lambda>
    channel = ChannelPromise(lambda: connection.default_channel)
  File "/usr/local/lib/python2.7/site-packages/kombu/connection.py", line 819, in default_channel
    self.connection
  File "/usr/local/lib/python2.7/site-packages/kombu/connection.py", line 802, in connection
    self._connection = self._establish_connection()
  File "/usr/local/lib/python2.7/site-packages/kombu/connection.py", line 757, in _establish_connection
    conn = self.transport.establish_connection()
  File "/usr/local/lib/python2.7/site-packages/kombu/transport/pyamqp.py", line 130, in establish_connection
    conn.connect()
  File "/usr/local/lib/python2.7/site-packages/amqp/connection.py", line 294, in connect
    self.transport.connect()
  File "/usr/local/lib/python2.7/site-packages/amqp/transport.py", line 120, in connect
    self._connect(self.host, self.port, self.connect_timeout)
  File "/usr/local/lib/python2.7/site-packages/amqp/transport.py", line 161, in _connect
    self.sock.connect(sa)
  File "/usr/local/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
[2017-03-17 15:10:28,508: DEBUG/MainProcess] Closed channel #1
[2017-03-17 15:10:28,570: DEBUG/MainProcess] | Consumer: Restarting event loop...
[2017-03-17 15:10:28,572: DEBUG/MainProcess] | Consumer: Restarting Gossip...
[2017-03-17 15:10:28,575: DEBUG/MainProcess] | Consumer: Restarting Heart...
[2017-03-17 15:10:28,648: DEBUG/MainProcess] | Consumer: Restarting Control...
[2017-03-17 15:10:28,655: DEBUG/MainProcess] | Consumer: Restarting Tasks...
[2017-03-17 15:10:28,655: DEBUG/MainProcess] Canceling task consumer...
[2017-03-17 15:10:28,655: DEBUG/MainProcess] | Consumer: Restarting Mingle...
[2017-03-17 15:10:28,655: DEBUG/MainProcess] | Consumer: Restarting Events...
[2017-03-17 15:10:28,672: DEBUG/MainProcess] | Consumer: Restarting Connection...
[2017-03-17 15:10:28,673: DEBUG/MainProcess] | Consumer: Starting Connection
[2017-03-17 15:10:28,947: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@rabbitmq1:5672//: [Errno 111] Connection refused.
Will retry using next failover.

[2017-03-17 15:10:29,345: DEBUG/MainProcess] Start from server, version: 0.9, properties: {'information': 'Licensed under the MPL.  See http://www.rabbitmq.com/', 'product': 'RabbitMQ', 'copyright': 'Copyright (C) 2007-2016 Pivotal Software, Inc.', 'capabilities': {'exchange_exchange_bindings': True, 'connection.blocked': True, 'authentication_failure_close': True, 'direct_reply_to': True, 'basic.nack': True, 'per_consumer_qos': True, 'consumer_priorities': True, 'consumer_cancel_notify': True, 'publisher_confirms': True}, 'cluster_name': 'rabbit@rabbitmq1', 'platform': 'Erlang/OTP', 'version': '3.6.6'}, mechanisms: [u'PLAIN', u'AMQPLAIN'], locales: [u'en_US']
[2017-03-17 15:10:29,506: INFO/MainProcess] Connected to amqp://guest:**@rabbitmq2:5672//
[2017-03-17 15:10:29,535: DEBUG/MainProcess] ^-- substep ok
[2017-03-17 15:10:29,569: DEBUG/MainProcess] | Consumer: Starting Events
[2017-03-17 15:10:29,682: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@rabbitmq1:5672//: [Errno 111] Connection refused.
Will retry using next failover.

[2017-03-17 15:10:29,740: DEBUG/MainProcess] Start from server, version: 0.9, properties: {'information': 'Licensed under the MPL.  See http://www.rabbitmq.com/', 'product': 'RabbitMQ', 'copyright': 'Copyright (C) 2007-2016 Pivotal Software, Inc.', 'capabilities': {'exchange_exchange_bindings': True, 'connection.blocked': True, 'authentication_failure_close': True, 'direct_reply_to': True, 'basic.nack': True, 'per_consumer_qos': True, 'consumer_priorities': True, 'consumer_cancel_notify': True, 'publisher_confirms': True}, 'cluster_name': 'rabbit@rabbitmq1', 'platform': 'Erlang/OTP', 'version': '3.6.6'}, mechanisms: [u'PLAIN', u'AMQPLAIN'], locales: [u'en_US']
[2017-03-17 15:10:29,768: DEBUG/MainProcess] ^-- substep ok
[2017-03-17 15:10:29,770: DEBUG/MainProcess] | Consumer: Starting Mingle
[2017-03-17 15:10:29,770: INFO/MainProcess] mingle: searching for neighbors
[2017-03-17 15:10:29,771: DEBUG/MainProcess] using channel_id: 1
[2017-03-17 15:10:29,795: DEBUG/MainProcess] Channel open
[2017-03-17 15:10:29,874: WARNING/MainProcess] consumer: Connection to broker lost. Trying to re-establish the connection...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/celery/worker/consumer/consumer.py", line 318, in start
    blueprint.start(self)
  File "/usr/local/lib/python2.7/site-packages/celery/bootsteps.py", line 119, in start
    step.start(parent)
  File "/usr/local/lib/python2.7/site-packages/celery/worker/consumer/mingle.py", line 38, in start
    self.sync(c)
  File "/usr/local/lib/python2.7/site-packages/celery/worker/consumer/mingle.py", line 42, in sync
    replies = self.send_hello(c)
  File "/usr/local/lib/python2.7/site-packages/celery/worker/consumer/mingle.py", line 55, in send_hello
    replies = inspect.hello(c.hostname, our_revoked._data) or {}
  File "/usr/local/lib/python2.7/site-packages/celery/app/control.py", line 129, in hello
    return self._request('hello', from_node=from_node, revoked=revoked)
  File "/usr/local/lib/python2.7/site-packages/celery/app/control.py", line 81, in _request
    timeout=self.timeout, reply=True,
  File "/usr/local/lib/python2.7/site-packages/celery/app/control.py", line 436, in broadcast
    limit, callback, channel=channel,
  File "/usr/local/lib/python2.7/site-packages/kombu/pidbox.py", line 315, in _broadcast
    serializer=serializer)
  File "/usr/local/lib/python2.7/site-packages/kombu/pidbox.py", line 290, in _publish
    serializer=serializer,
  File "/usr/local/lib/python2.7/site-packages/kombu/messaging.py", line 181, in publish
    exchange_name, declare,
  File "/usr/local/lib/python2.7/site-packages/kombu/messaging.py", line 187, in _publish
    channel = self.channel
  File "/usr/local/lib/python2.7/site-packages/kombu/messaging.py", line 209, in _get_channel
    channel = self._channel = channel()
  File "/usr/local/lib/python2.7/site-packages/kombu/utils/functional.py", line 38, in __call__
    value = self.__value__ = self.__contract__()
  File "/usr/local/lib/python2.7/site-packages/kombu/messaging.py", line 224, in <lambda>
    channel = ChannelPromise(lambda: connection.default_channel)
  File "/usr/local/lib/python2.7/site-packages/kombu/connection.py", line 819, in default_channel
    self.connection
  File "/usr/local/lib/python2.7/site-packages/kombu/connection.py", line 802, in connection
    self._connection = self._establish_connection()
  File "/usr/local/lib/python2.7/site-packages/kombu/connection.py", line 757, in _establish_connection
    conn = self.transport.establish_connection()
  File "/usr/local/lib/python2.7/site-packages/kombu/transport/pyamqp.py", line 130, in establish_connection
    conn.connect()
  File "/usr/local/lib/python2.7/site-packages/amqp/connection.py", line 294, in connect
    self.transport.connect()
  File "/usr/local/lib/python2.7/site-packages/amqp/transport.py", line 120, in connect
    self._connect(self.host, self.port, self.connect_timeout)
  File "/usr/local/lib/python2.7/site-packages/amqp/transport.py", line 161, in _connect
    self.sock.connect(sa)
  File "/usr/local/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
[2017-03-17 15:10:29,887: DEBUG/MainProcess] Closed channel #1
[2017-03-17 15:10:29,907: DEBUG/MainProcess] | Consumer: Restarting event loop...
[2017-03-17 15:10:29,908: DEBUG/MainProcess] | Consumer: Restarting Gossip...
[2017-03-17 15:10:29,908: DEBUG/MainProcess] | Consumer: Restarting Heart...
[2017-03-17 15:10:29,908: DEBUG/MainProcess] | Consumer: Restarting Control...
[2017-03-17 15:10:29,909: DEBUG/MainProcess] | Consumer: Restarting Tasks...
[2017-03-17 15:10:29,910: DEBUG/MainProcess] Canceling task consumer...
[2017-03-17 15:10:29,911: DEBUG/MainProcess] | Consumer: Restarting Mingle...
[2017-03-17 15:10:29,912: DEBUG/MainProcess] | Consumer: Restarting Events...
[2017-03-17 15:10:29,953: DEBUG/MainProcess] | Consumer: Restarting Connection...
[2017-03-17 15:10:29,954: DEBUG/MainProcess] | Consumer: Starting Connection
[2017-03-17 15:10:30,036: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@rabbitmq1:5672//: [Errno 111] Connection refused.
Will retry using next failover.

pip list:

...
amqp (2.1.4)
celery (4.0.2)
flower (0.9.1)
kombu (4.0.2)
pep8 (1.7.0)
pip (9.0.1)
setuptools (34.3.0)
six (1.10.0)
...

Activity

  1. changed the title [-]Celery worker can't connect to RabbitMQ broker failover[/-] [+]Celery 4 worker can't connect to RabbitMQ broker failover[/+] on Mar 17, 2017
  2. extra-sterk commented on Mar 30, 2017

    @extra-sterk

    I have this same issue.

  3. georgepsarakis commented on Apr 7, 2017

    @georgepsarakis
    Contributor

    @csterk or @draskomikic could you try the following patch please?

    Change this line of the Inspect._request method to:

    connection=None,
    

    If this works we could then start working on a proper way to fix this bug.

  4. draskomikic commented on Apr 7, 2017

    @draskomikic
    Author

    Hi George,

    I have tried to set *connection=None* like you proposed, but no luck,
    same issue happens.

    I have also tried to set Celery configuration parameter
    broker_connection_max_retries=3 since default is 100, but again same
    issue, looks like it doesn't have effect on this problem.

    I have also added one line in amqp/transport.py library to print out node
    in use:
    print("---------------------NOW USING NODE: {}".format(self.host))

    Line is added before:
    https://github.com/celery/py-amqp/blob/master/amqp/transport.py#L120

    According to logs it seems that Celery has conflict in connecting to
    failover node and reconnecting to node that went down. More precisely, it
    looks like by trying to reconnect to master node it interrupts connection
    to failover node.

    You can see celery log output when I stop rabbitmq1 RabbitMQ node:

    [2017-04-07 11:29:35,245: WARNING/MainProcess] ---------------------NOW
    USING NODE: rabbitmq1
    [2017-04-07 11:29:35,276: ERROR/MainProcess] consumer: Cannot connect to
    amqp://guest:**@rabbitmq1:5672//: [Errno 111] Connection refused.
    Will retry using next failover.
    
    [2017-04-07 11:29:35,334: WARNING/MainProcess] ---------------------NOW
    USING NODE: rabbitmq2
    [2017-04-07 11:29:35,378: DEBUG/MainProcess] Start from server, version:
    0.9, properties: {'information': 'Licensed under the MPL.  See
    http://www.rabbitmq.com/', 'product': 'RabbitMQ', 'copyright': 'Copyright
    (C) 2007-2016 Pivotal Software, Inc.', 'capabilities':
    {'exchange_exchange_bindings': True, 'connection.blocked': True,
    'authentication_failure_close': True, 'direct_reply_to': True,
    'basic.nack': True, 'per_consumer_qos': True, 'consumer_priorities': True,
    'consumer_cancel_notify': True, 'publisher_confirms': True},
    'cluster_name': 'rabbit@rabbitmq2', 'platform': 'Erlang/OTP', 'version':
    '3.6.6'}, mechanisms: [u'PLAIN', u'AMQPLAIN'], locales: [u'en_US']
    [2017-04-07 11:29:35,386: INFO/MainProcess] Connected to
    amqp://guest:**@rabbitmq2:5672//
    [2017-04-07 11:29:35,392: DEBUG/MainProcess] ^-- substep ok
    [2017-04-07 11:29:35,396: DEBUG/MainProcess] | Consumer: Starting Events
    [2017-04-07 11:29:35,426: WARNING/MainProcess] ---------------------NOW
    USING NODE: rabbitmq1
    [2017-04-07 11:29:35,452: ERROR/MainProcess] consumer: Cannot connect to
    amqp://guest:**@rabbitmq1:5672//: [Errno 111] Connection refused.
    Will retry using next failover.
    
    [2017-04-07 11:29:35,551: WARNING/MainProcess] ---------------------NOW
    USING NODE: rabbitmq2
    [2017-04-07 11:29:35,567: DEBUG/MainProcess] Start from server, version:
    0.9, properties: {'information': 'Licensed under the MPL.  See
    http://www.rabbitmq.com/', 'product': 'RabbitMQ', 'copyright': 'Copyright
    (C) 2007-2016 Pivotal Software, Inc.', 'capabilities':
    {'exchange_exchange_bindings': True, 'connection.blocked': True,
    'authentication_failure_close': True, 'direct_reply_to': True,
    'basic.nack': True, 'per_consumer_qos': True, 'consumer_priorities': True,
    'consumer_cancel_notify': True, 'publisher_confirms': True},
    'cluster_name': 'rabbit@rabbitmq2', 'platform': 'Erlang/OTP', 'version':
    '3.6.6'}, mechanisms: [u'PLAIN', u'AMQPLAIN'], locales: [u'en_US']
    [2017-04-07 11:29:35,582: DEBUG/MainProcess] ^-- substep ok
    [2017-04-07 11:29:35,587: DEBUG/MainProcess] | Consumer: Starting Mingle
    [2017-04-07 11:29:35,588: INFO/MainProcess] mingle: searching for neighbors
    [2017-04-07 11:29:35,640: WARNING/MainProcess] ---------------------NOW
    USING NODE: rabbitmq1
    [2017-04-07 11:29:35,666: WARNING/MainProcess] consumer: Connection to
    broker lost. Trying to re-establish the connection...
    Traceback (most recent call last):
      File
    "/usr/local/lib/python2.7/site-packages/celery/worker/consumer/consumer.py",
    line 318, in start
        blueprint.start(self)
      File "/usr/local/lib/python2.7/site-packages/celery/bootsteps.py", line
    119, in start
        step.start(parent)
      File
    "/usr/local/lib/python2.7/site-packages/celery/worker/consumer/mingle.py",
    line 38, in start
        self.sync(c)
      File
    "/usr/local/lib/python2.7/site-packages/celery/worker/consumer/mingle.py",
    line 42, in sync
        replies = self.send_hello(c)
      File
    "/usr/local/lib/python2.7/site-packages/celery/worker/consumer/mingle.py",
    line 55, in send_hello
        replies = inspect.hello(c.hostname, our_revoked._data) or {}
      File "/usr/local/lib/python2.7/site-packages/celery/app/control.py", line
    121, in hello
        return self._request('hello', from_node=from_node, revoked=revoked)
      File "/usr/local/lib/python2.7/site-packages/celery/app/control.py", line
    74, in _request
        return self._prepare(self.app.control.broadcast(command,
    arguments=kwargs, destination=self.destination, callback=self.callback,
    connection=None, limit=self.limit, timeout=self.timeout, reply=True,))
      File "/usr/local/lib/python2.7/site-packages/celery/app/control.py", line
    428, in broadcast
        limit, callback, channel=channel,
      File "/usr/local/lib/python2.7/site-packages/kombu/pidbox.py", line 304,
    in _broadcast
        chan = channel or self.connection.default_channel
      File "/usr/local/lib/python2.7/site-packages/kombu/connection.py", line
    819, in default_channel
        self.connection
      File "/usr/local/lib/python2.7/site-packages/kombu/connection.py", line
    802, in connection
        self._connection = self._establish_connection()
      File "/usr/local/lib/python2.7/site-packages/kombu/connection.py", line
    757, in _establish_connection
        conn = self.transport.establish_connection()
      File "/usr/local/lib/python2.7/site-packages/kombu/transport/pyamqp.py",
    line 130, in establish_connection
        conn.connect()
      File "/usr/local/lib/python2.7/site-packages/amqp/connection.py", line
    294, in connect
        self.transport.connect()
      File "/usr/local/lib/python2.7/site-packages/amqp/transport.py", line
    121, in connect
        self._connect(self.host, self.port, self.connect_timeout)
      File "/usr/local/lib/python2.7/site-packages/amqp/transport.py", line
    162, in _connect
        self.sock.connect(sa)
      File "/usr/local/lib/python2.7/socket.py", line 228, in meth
        return getattr(self._sock,name)(*args)
    error: [Errno 111] Connection refused
    [2017-04-07 11:29:35,673: DEBUG/MainProcess] | Consumer: Restarting event
    loop...
    [2017-04-07 11:29:35,681: DEBUG/MainProcess] | Consumer: Restarting
    Gossip...
    [2017-04-07 11:29:35,683: DEBUG/MainProcess] | Consumer: Restarting Heart...
    [2017-04-07 11:29:35,684: DEBUG/MainProcess] | Consumer: Restarting
    Control...
    [2017-04-07 11:29:35,685: DEBUG/MainProcess] | Consumer: Restarting Tasks...
    [2017-04-07 11:29:35,687: DEBUG/MainProcess] Canceling task consumer...
    [2017-04-07 11:29:35,688: DEBUG/MainProcess] | Consumer: Restarting
    Mingle...
    [2017-04-07 11:29:35,694: DEBUG/MainProcess] | Consumer: Restarting
    Events...
    [2017-04-07 11:29:35,700: DEBUG/MainProcess] | Consumer: Restarting
    Connection...
    [2017-04-07 11:29:35,702: DEBUG/MainProcess] | Consumer: Starting Connection
    [2017-04-07 11:29:35,749: WARNING/MainProcess] ---------------------NOW
    USING NODE: rabbitmq1
    [2017-04-07 11:29:35,767: ERROR/MainProcess] consumer: Cannot connect to
    amqp://guest:**@rabbitmq1:5672//: [Errno 111] Connection refused.
    Will retry using next failover.
    
    [2017-04-07 11:29:35,809: WARNING/MainProcess] ---------------------NOW
    USING NODE: rabbitmq2
    [2017-04-07 11:29:35,826: DEBUG/MainProcess] Start from server, version:
    0.9, properties: {'information': 'Licensed under the MPL.  See
    http://www.rabbitmq.com/', 'product': 'RabbitMQ', 'copyright': 'Copyright
    (C) 2007-2016 Pivotal Software, Inc.', 'capabilities':
    {'exchange_exchange_bindings': True, 'connection.blocked': True,
    'authentication_failure_close': True, 'direct_reply_to': True,
    'basic.nack': True, 'per_consumer_qos': True, 'consumer_priorities': True,
    'consumer_cancel_notify': True, 'publisher_confirms': True},
    'cluster_name': 'rabbit@rabbitmq2', 'platform': 'Erlang/OTP', 'version':
    '3.6.6'}, mechanisms: [u'PLAIN', u'AMQPLAIN'], locales: [u'en_US']
    [2017-04-07 11:29:35,850: INFO/MainProcess] Connected to
    amqp://guest:**@rabbitmq2:5672//
    [2017-04-07 11:29:35,853: DEBUG/MainProcess] ^-- substep ok
    [2017-04-07 11:29:35,863: DEBUG/MainProcess] | Consumer: Starting Events
    [2017-04-07 11:29:35,890: WARNING/MainProcess] ---------------------NOW
    USING NODE: rabbitmq1
    [2017-04-07 11:29:35,926: ERROR/MainProcess] consumer: Cannot connect to
    amqp://guest:**@rabbitmq1:5672//: [Errno 111] Connection refused.
    Will retry using next failover.
    
    [2017-04-07 11:29:35,965: WARNING/MainProcess] ---------------------NOW
    USING NODE: rabbitmq2
    [2017-04-07 11:29:35,986: DEBUG/MainProcess] Start from server, version:
    0.9, properties: {'information': 'Licensed under the MPL.  See
    http://www.rabbitmq.com/', 'product': 'RabbitMQ', 'copyright': 'Copyright
    (C) 2007-2016 Pivotal Software, Inc.', 'capabilities':
    {'exchange_exchange_bindings': True, 'connection.blocked': True,
    'authentication_failure_close': True, 'direct_reply_to': True,
    'basic.nack': True, 'per_consumer_qos': True, 'consumer_priorities': True,
    'consumer_cancel_notify': True, 'publisher_confirms': True},
    'cluster_name': 'rabbit@rabbitmq2', 'platform': 'Erlang/OTP', 'version':
    '3.6.6'}, mechanisms: [u'PLAIN', u'AMQPLAIN'], locales: [u'en_US']
    [2017-04-07 11:29:35,990: DEBUG/MainProcess] ^-- substep ok
    [2017-04-07 11:29:35,991: DEBUG/MainProcess] | Consumer: Starting Mingle
    [2017-04-07 11:29:35,991: INFO/MainProcess] mingle: searching for neighbors
    [2017-04-07 11:29:36,013: WARNING/MainProcess] ---------------------NOW
    USING NODE: rabbitmq1
    [2017-04-07 11:29:36,024: WARNING/MainProcess] consumer: Connection to
    broker lost. Trying to re-establish the connection...
    
  5. georgepsarakis commented on Apr 8, 2017

    @georgepsarakis
    Contributor

    @draskomikic did you try starting the worker with the --without-mingle option? This is still a bug (I think) but maybe this may be a temporary workaround for some cases.

  6. draskomikic commented on Apr 10, 2017

    @draskomikic
    Author

    Hi George,

    I have run some basis tests using --without-mingle option and it seems to be working just fine. I can see in logs that Celery workers immediately connect to next RabbitMQ node and that workers are able to continue consuming tasks from second RabbitMQ node.

    Thank you very much for all help, let me know if I can somehow help you with this bug fix.

  7. georgepsarakis commented on Apr 10, 2017

    @georgepsarakis
    Contributor

    @draskomikic great 😄 , happy to help! Yes, I believe we need to solve this. I will give it some thought and let you know.

  8. thedrow commented on Apr 16, 2017

    @thedrow
    Contributor

    @georgepsarakis Great job troubleshooting this. Have you thought about how to fix this?

    Btw, can you use the labels to triage issues. It's easier for others to filter them based on their expertise.

  9. georgepsarakis commented on Apr 16, 2017

    @georgepsarakis
    Contributor

    @thedrow you mean adding the Component: * labels? If yes, then you are right, I should be doing this more often, sorry.

    I haven't yet concluded on how we can fix this, as it goes beyond my understanding of the project internals. I will have another look and let you know if I have any suggestions.

  10. monitorius commented on Apr 19, 2017

    @monitorius

    I have exactly same problem, and --without-mingle fixed it. Thanks for workaround.

  11. monitorius commented on Apr 19, 2017

    @monitorius

    Looks like it's a bit deeper. The same issue exists with task producer - if it's connected to a rabbit node and this node dies, producer is unable to establish stable connection to failover node.
    I see infinite log of something like this on producer:

    DEBUG 2017-04-19 14:49:43,263 73960 amqp Start from server, version: 0.9, properties: {'information': 'Licensed under the MPL.  See http://www.rabbitmq.com/', 'product': 'RabbitMQ', 'copyright': 'Copyright (C) 2007-2016 Pivotal Software, Inc.', 'capabilities': {'exchange_exchange_bindings': True, 'connection.blocked': True, 'authentication_failure_close': True, 'direct_reply_to': True, 'basic.nack': True, 'per_consumer_qos': True, 'consumer_priorities': True, 'consumer_cancel_notify': True, 'publisher_confirms': True}, 'cluster_name': 'rabbit@mondev2', 'platform': 'Erlang/OTP', 'version': '3.6.1-yandex0'}, mechanisms: [u'AMQPLAIN', u'PLAIN'], locales: [u'en_US']
    DEBUG 2017-04-19 14:49:43,314 73960 amqp using channel_id: 1
    DEBUG 2017-04-19 14:49:43,340 73960 amqp Channel open
    DEBUG 2017-04-19 14:49:43,343 73960 amqp Closed channel #1
    DEBUG 2017-04-19 14:49:43,401 73960 amqp Start from server, version: 0.9, properties: {'information': 'Licensed under the MPL.  See http://www.rabbitmq.com/', 'product': 'RabbitMQ', 'copyright': 'Copyright (C) 2007-2016 Pivotal Software, Inc.', 'capabilities': {'exchange_exchange_bindings': True, 'connection.blocked': True, 'authentication_failure_close': True, 'direct_reply_to': True, 'basic.nack': True, 'per_consumer_qos': True, 'consumer_priorities': True, 'consumer_cancel_notify': True, 'publisher_confirms': True}, 'cluster_name': 'rabbit@mondev2', 'platform': 'Erlang/OTP', 'version': '3.6.1-yandex0'}, mechanisms: [u'AMQPLAIN', u'PLAIN'], locales: [u'en_US']
    DEBUG 2017-04-19 14:49:43,450 73960 amqp using channel_id: 1
    DEBUG 2017-04-19 14:49:43,476 73960 amqp Channel open
    DEBUG 2017-04-19 14:49:43,477 73960 amqp Closed channel #1
    

    And on failover rabbit node:

    =WARNING REPORT==== 19-Apr-2017::14:51:29 ===
    closing AMQP connection <0.6913.1> ([2A02:6B8:0:1A71::2953]:42490 -> [2A02:6B8:C01:304:0:639:0:1EC]:5672):
    client unexpectedly closed TCP connection
    
    =INFO REPORT==== 19-Apr-2017::14:51:29 ===
    accepting AMQP connection <0.6924.1> ([2A02:6B8:0:1A71::2953]:42491 -> [2A02:6B8:C01:304:0:639:0:1EC]:5672)
    
    =WARNING REPORT==== 19-Apr-2017::14:51:29 ===
    closing AMQP connection <0.6924.1> ([2A02:6B8:0:1A71::2953]:42491 -> [2A02:6B8:C01:304:0:639:0:1EC]:5672):
    client unexpectedly closed TCP connection
    
    =INFO REPORT==== 19-Apr-2017::14:51:29 ===
    accepting AMQP connection <0.6935.1> ([2A02:6B8:0:1A71::2953]:42492 -> [2A02:6B8:C01:304:0:639:0:1EC]:5672)
    
    =WARNING REPORT==== 19-Apr-2017::14:51:29 ===
    closing AMQP connection <0.6935.1> ([2A02:6B8:0:1A71::2953]:42492 -> [2A02:6B8:C01:304:0:639:0:1EC]:5672):
    client unexpectedly closed TCP connection
    
    

    And mingle stuff has nothing to do with producer, right?
    Setup is the same as I used to test workers with "--without-mingle"

  12. georgepsarakis commented on Apr 19, 2017

    @georgepsarakis
    Contributor

    @draskomikic @monitorius can you please try this patch: celery/kombu#724 ?

  13. 21 remaining items

  14. mirasrael commented on Sep 29, 2017

    @mirasrael

    @draskomikic I tried to fix this issue with proxying default_channel (which will automatically replace default channel in case of reconnect). Can you please test if it works for you (before I create pull request)?

    https://github.com/mirasrael/kombu/tree/fix-reconnect-for-send-message

  15. added this to the milestone on Dec 20, 2017
  16. auvipy commented on Jan 9, 2018

    @auvipy
    Member

    can you look into the last comment of the issue #4075

  17. auvipy commented on Jan 9, 2018

    @auvipy
    Member

    @mirasrael plz send a pr with test

  18. thijstriemstra commented on Jan 16, 2018

    @thijstriemstra
    Contributor

    Also encountered this issue (I think) using Celery 4.1.0, rabbitmq log was filling up with 1000s of messages like:

    =WARNING REPORT==== 16-Jan-2018::06:31:37 ===
    closing AMQP connection <0.2312.2> (192.168.82.10:51450 -> 192.168.82.1:5671, vhost: 'myvhost', user: 'celery'):
    client unexpectedly closed TCP connection
    
    =INFO REPORT==== 16-Jan-2018::06:31:38 ===
    accepting AMQP connection <0.2325.2> (192.168.82.10:51452 -> 192.168.82.1:5671)
    
    =INFO REPORT==== 16-Jan-2018::06:31:38 ===
    connection <0.2325.2> (192.168.82.10:51452 -> 192.168.82.1:5671): user 'celery' authenticated and granted access to vhost 'myvhost'
    
    =WARNING REPORT==== 16-Jan-2018::06:31:38 ===
    closing AMQP connection <0.2325.2> (192.168.82.10:51452 -> 192.168.82.1:5671, vhost: 'myvhost', user: 'celery'):
    client unexpectedly closed TCP connection
    
    =INFO REPORT==== 16-Jan-2018::06:31:38 ===
    accepting AMQP connection <0.2338.2> (192.168.82.10:51454 -> 192.168.82.1:5671)
    
    =INFO REPORT==== 16-Jan-2018::06:31:38 ===
    connection <0.2338.2> (192.168.82.10:51454 -> 192.168.82.1:5671): user 'celery' authenticated and granted access to vhost 'myvhost'
    
    =WARNING REPORT==== 16-Jan-2018::06:31:38 ===
    closing AMQP connection <0.2338.2> (192.168.82.10:51454 -> 192.168.82.1:5671, vhost: 'myvhost', user: 'celery'):
    client unexpectedly closed TCP connection
    
    etc...
    

    This happened after restarting the device running the rabbitmq server and worker. The client calling the tasks would go crazy on rabbitmq once that server+worker came back online. Removing the result_backend = rpc:// fixed the problem.

  19. 23doors commented on Feb 13, 2018

    @23doors
    Contributor

    Is 4.2 coming any time soon then?

  20. modified the milestones: , v4.3 on May 27, 2018
  21. auvipy commented on Aug 10, 2018

    @auvipy
    Member

    Can anyone confirm this issue with the latest release?

  22. modified the milestones: v4.3, v5.0.0 on Nov 18, 2018
  23. removed this from the v5.0.0 milestone on Jul 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions