perrich / Hangfire.MemoryStorage

A memory storage for Hangfire.
Apache License 2.0
131 stars 43 forks source link

An item with same key already added. #22

Closed pmcfernandes closed 5 years ago

pmcfernandes commented 6 years ago

ArgumentException: Um item com a mesma chave já foi adicionado.] System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +52 System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) +12998942 System.Linq.Enumerable.ToDictionary(IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer) +247 Hangfire.MemoryStorage.MemoryStorageConnection.GetAllEntriesFromHash(String key) +260 Hangfire.RecurringJobManager.AddOrUpdate(String recurringJobId, Job job, String cronExpression, RecurringJobOptions options) +244 Hangfire.RecurringJobManagerExtensions.AddOrUpdate(IRecurringJobManager manager, String recurringJobId, Job job, String cronExpression, TimeZoneInfo timeZone, String queue) +107 Hangfire.RecurringJob.AddOrUpdate(Expression1 methodCall, String cronExpression, TimeZoneInfo timeZone, String queue) +165

jeansimoncollard commented 5 years ago

The AddOrUpdate method is not thread safe. You have a race condition somewhere. Add locks around it.