Skip to content

Erlang client may error out due to basic.cancel race condition #4070

@lhoguin

Description

@lhoguin

https://www.rabbitmq.com/consumer-cancel.html

It is not an error for the client to issue a basic.cancel for a consumer which has been unexpectedly cancelled (e.g. due to queue deletion). By definition, there is a race possible between a client issuing a basic.cancel, and the broker sending out the asynchronous notification. In such cases, the broker does not error when it receives the basic.cancel and replies with a basic.cancel-ok as normal.

When this happens the Erlang client exits with an unexpected_delivery_and_no_default_consumer error. The scenario is as follow:

  • Server sends a basic.cancel, channel removes consumer from its state (amqp_selective_consumer specifically)

  • Channel sends the basic.cancel message to user but user doesn't see it

  • User tells channel to basic.cancel, channel sends basic.cancel to server

  • Server sends back a basic.cancel_ok, channel doesn't know about the consumer anymore, can't forward message and exits with an error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions