Skip to content

Race condition in Azure Service Bus queue #43

@jamie94bc

Description

@jamie94bc

As mentioned by @moswald in #38 ...

  1. In parallel, Thread A calls EnqueueAsync() and Thread B calls DeleteQueueAsync()
  2. Thread A passes through EnsureQueueCreatedAsync(), ensuring _queueClient is not null
  3. Thread B deletes the queue, setting _queueClient to null
  4. Thread A tries to use _queueCleint which is now null

There's not really a nice way to handle this without locking. Couple of solutions:

Option 1

Wrap _queueClient in a property which throws a slightly different exception, leaving the user to retry.

Option 2

Implement retry logic (preferably in QueueBase).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions