-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hangfire.Storage.DistributedLockTimeoutException: Timeout expired #1342
Comments
I am having the same issue. I have this attribute on my method: [DisableConcurrentExecution(timeoutInSeconds: 10 * 60)] In my case it is a recurring task that executes every hour. |
Having the same problem over here. Is there some configuration missing? Am using RavenDB for storage. Hangfire.Server.DelayedJobScheduler:Debug: An exception was thrown during acquiring distributed lock on the locks:schedulepoller resource within 60 seconds. The scheduled jobs have not been handled this time. Hangfire.Storage.DistributedLockTimeoutException: Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the 'HangFire/locks:schedulepoller' resource. Hangfire.Storage.DistributedLockTimeoutException: Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the 'HangFire/recurring-jobs:lock' resource. |
Hi has anyone found a solution to this yet? |
Happening for me too. I wish to find a solution to this. Again, it's only for long running jobs that run into each other. |
Having the same issue w a Long running job |
Set QueuePollInterval to 30 and it resolved the issue for me. |
@kashyapus u mean QueuePollInterval = TimeSpan.FromSeconds(30) (30 seconds or other value u meant? |
Yes you are correct. TimeSpan.FromSeconds(30) |
What does QueuePollInterval when set to a higher value actually do? Does it decrease the amount of polls per timespan? |
Did anyone manage to resolve this? I tried increasing QueuePollInterval to 35seconds and still getting this issue. |
Any feedback on this? We are also getting this error on a recurring job. |
For my case, it was because I called app.UseHangfireServer(), when I've already added services.AddHangfireServer(); in the configure method above. Removing that line solved this issue for me. |
Everything works perfectly in development mode; this only happens to me when I deploy my service to the service. I have the following configuration: |
the same to me , I also got this issue in the Production environment: Stopped program because of exception||Hangfire.Storage.DistributedLockTimeoutException: Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the 'HangFire:lock:recurring-job:PeriodicCleanupFileStorageJob' resource.
at Hangfire.SqlServer.SqlServerDistributedLock.Acquire(IDbConnection connection, String resource, TimeSpan timeout)
at Hangfire.SqlServer.SqlServerConnection.AcquireLock(String resource, TimeSpan timeout)
at Hangfire.SqlServer.SqlServerConnection.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.RecurringJobManagerExtensions.AddOrUpdate(IRecurringJobManager manager, String recurringJobId, Job job, String cronExpression, TimeZoneInfo timeZone, String queue) |
I'm getting the same errors as the people above. @odinserj Can you please look into it? It's quite annoying and it's basically breaking our entire environment. |
Please try to use Microsoft.Data.SqlClient package of the latest version instead as shown here – #1735 (comment). There are strange problems with connections in System.Data.SqlClient that's solved by using MD.SqlClient, and connection can hold locks. |
All the recent problems with SQL Server were fixed by using that new package, some reported to support, and one of them is #2065. So there's a high chance this problem can also be resolved by a simple upgrade. |
Did you resolve it? I am trying call service from service and receive error too. |
|
@odinserj i am facing the same issue "Hangfire.Storage.DistributedLockTimeoutException can you please let me know if this issue is fixed or not. Using attributes like |
I was having the same issue, there's nothing wrong with the application, it's just that this is a recurring job that runs once per 15 minutes. The programmer added the attribute to ensure that only 1 instance is running in case if the job runs for like an hour. if the next job runs before the first job finish, you will see that error in the hangfire admin site |
Happened to me today. Recurring jobs all stopped. Lock got stuck. |
Hi, I'm using Hangfire with Mssql.
I keep having timeout issues on recurring jobs.
Hangfire.Storage.DistributedLockTimeoutException
Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the 'HangFire:HangfireBootstrapper.BackgroundTaskRunner.RunAll' resource.
Hangfire.Storage.DistributedLockTimeoutException: Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the 'HangFire:HangfireBootstrapper.BackgroundTaskRunner.RunAll' resource.
at Hangfire.SqlServer.SqlServerDistributedLock.Acquire(IDbConnection connection, String resource, TimeSpan timeout)
at Hangfire.SqlServer.SqlServerConnection.AcquireLock(String resource, TimeSpan timeout)
at Hangfire.SqlServer.SqlServerConnection.AcquireDistributedLock(String resource, TimeSpan timeout)
at Hangfire.DisableConcurrentExecutionAttribute.OnPerforming(PerformingContext filterContext)
at Hangfire.Server.BackgroundJobPerformer.InvokePerformFilter(IServerFilter filter, PerformingContext preContext, Func`1 continuation)
Any idea how to fix that?
Thanks
The text was updated successfully, but these errors were encountered: