HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.32k stars 1.69k forks source link

The timeout elapsed prior to obtaining a distributed lock (Redis) #2361

Open MostafaSDesoky opened 7 months ago

MostafaSDesoky commented 7 months ago

Hello I've a problem and unfortunately I have no idea why the error I'm using Hangfire.Core 1.8.3 Hanfire.ASPNetCore 1.8.3 Hangfire.Redis.StackExchange 1.8.3 Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the 'Failed to acquire lock on Tahrir_Hangfire_Prod_2lock:recurring-job:Auto Create within given timeout (00:00:15)' resource.

the full error in Event Viewer hit unexpected managed exception, exception code = '0xe0434352'. First 30KB characters of captured stdout and stderr logs: Unhandled exception. Hangfire.Storage.DistributedLockTimeoutException: Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the 'Failed to acquire lock on Tahrir_Hangfire_Prod_2lock:recurring-job:Auto Create within given timeout (00:00:15)' resource. 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.RecurringJobManager.AddOrUpdate(String recurringJobId, Job job, String cronExpression, RecurringJobOptions options) at Hangfire.RecurringJob.AddOrUpdate(String recurringJobId, Expression1 methodCall, String cronExpression, RecurringJobOptions options) at Hangfire.RecurringJob.AddOrUpdate(String recurringJobId, Expression1 methodCall, String cronExpression) at Tayar.API.Config.HangfireSetup.Seed(IConfiguration Configuration) at Tayar.API.Config.HangfireSetup.UseCustomConfig(IApplicationBuilder app, IConfiguration Configuration) at Program.

$(String[] args)

the real problem is it shutsdown the application I've searched about timeout and what could be the problem didn't manage to get a good solution thanks in advance

garrettlondon1 commented 1 month ago

Did you figure this out?

MostafaSDesoky commented 1 month ago

Did you figure this out?

not really I tried many solutions and called all my hangfire actions async but the same thing so i'm trying other approaches nowadays in hangfire to call directly the function