HangfireIO / HangfireIO/Hangfire.Azure.ServiceBusQueue
System.ArgumentException: An item with the same key has already been added.
- Dominant language
- C#
- Stars
- 59
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
This error occasionally occurs after launching a web application. The reason is probably due to the concurrent processing of two HTTP requests, each calling enqueue.
```
System.ArgumentException: An item with the same key has already been added. Key: default
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at Hangfire.Azure.ServiceBusQueue.ServiceBusManager.CreateQueueClients()
at Hangfire.Azure.ServiceBusQueue.ServiceBusManager.GetSenderAsync(String queue)
at Hangfire.Azure.ServiceBusQueue.ServiceBusQueueJobQueue.DoEnqueueAsync(List`1 jobs)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at ServiceBusManager.CreateQueueClients and trace how concurrent calls from GetSenderAsync and ServiceBusQueueJobQueue.DoEnqueueAsync initialize queue clients. Reproduce two simultaneous enqueue requests during application startup, then verify that initialization no longer raises a duplicate-key ArgumentException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100