marcoCasamento / Hangfire.Redis.StackExchange

HangFire Redis storage based on original (and now unsupported) Hangfire.Redis but using lovely StackExchange.Redis client
Other
452 stars 108 forks source link

Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct. #90

Closed xingyunauthor closed 3 years ago

xingyunauthor commented 4 years ago

System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct. at System.Collections.Generic.HashSet`1.Contains(T item) at Hangfire.Redis.RedisLock.Acquire(IDatabase redis, RedisKey key, TimeSpan timeOut, TimeSpan holdDuration) at Hangfire.Redis.RedisLock.Acquire(IDatabase redis, RedisKey key, TimeSpan timeOut) at Hangfire.Redis.RedisConnection.AcquireDistributedLock(String resource, TimeSpan timeout) at Hangfire.RecurringJobExtensions.AcquireDistributedRecurringJobLock(IStorageConnection connection, String recurringJobId, TimeSpan timeout) at Hangfire.Server.RecurringJobScheduler.EnqueueBackgroundJob(BackgroundProcessContext context, IStorageConnection connection, String recurringJobId, DateTime now) at Hangfire.Server.RecurringJobScheduler.TryEnqueueBackgroundJob(BackgroundProcessContext context, IStorageConnection connection, String recurringJobId, DateTime now)

xingyunauthor commented 4 years ago

I changed the code to private static ConcurrentDictionary<RedisKey, RedisKey> HeldLocks => new ConcurrentDictionary<RedisKey, RedisKey>(); 20 days ago, maybe solved this problem, and now not show this bug again