-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hi,
There is a race condition in the DefaultLockManager.
Scenario:
- thread A tries to lock on "123". It does not exist so it is created in the dictionary
- thread B tries to lock on "123". It exists and is currently locked by A, so it waits for A to finish.
- thread A finishes and removes the lock from the dictionary. Thread B enters the lock.
- thread C tries to lock on "123". It does not exist in the dictionary since thread A removed it, therefore it will start processing concurrently to thread B for the same key "123".
I am the author of https://github.com/MarkCiliaVincenti/AsyncKeyedLock and can help you implement the necessary changes. The library would also help you reduce memory allocations by pooling instances of SemaphoreSlim.
vposd
Metadata
Metadata
Assignees
Labels
No labels