Skip to content

Workers crash on startup with RabbitMQ 4.x — "540 NOT_IMPLEMENTED - queue does not support global qos" #2469

@Azd325

Description

@Azd325

Workers using the pyamqp transport crash immediately on
startup when connecting to RabbitMQ 4.x with:

540 NOT_IMPLEMENTED - queue 'your-queue' does not support global qos

Root Cause

qos_semantics_matches_spec in kombu/transport/pyamqp.py (and librabbitmq.py)
only has a special case for RabbitMQ < 3.3:

def qos_semantics_matches_spec(self, connection):
    props = connection.server_properties
    if props.get('product') == 'RabbitMQ':
        return version_string_as_tuple(props['version']) < (3, 3)
    return True

This returns False for all RabbitMQ >= 3.3, including 4.x. Celery then calls
basic.qos(global=True) (channel-wide prefetch), which RabbitMQ 4.0 removed
entirely from classic queues.

RabbitMQ 4.0 removed global QoS prefetch on classic queues entirely. See:

Fix

I'm wondering if this patch would be already enough.

def qos_semantics_matches_spec(self, connection):
    props = connection.server_properties
    if props.get('product') == 'RabbitMQ':
        version = version_string_as_tuple(props['version'])
        # RabbitMQ < 3.3: per-channel QoS (return True)
        # RabbitMQ 3.3–3.x: global QoS semantics (return False)
        # RabbitMQ 4.0+: global QoS removed on classic queues (return True)
        return version < (3, 3) or version >= (4, 0)
    return True

Environment

  • Kombu: 5.6.x
  • RabbitMQ: 4.0+
  • Celery: 5.6.x

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions