DistributedLockTimeoutException with Hangfire.Storage.SQLite

See original GitHub issue

I’m sorry I don’t know how to reliably reproduce this exception. All I can tell you is that MyJobClass.MyJobMethod has this attribute: [DisableConcurrentExecution(timeoutInSeconds: 10 * 60)] and that I’m using a TransactionScope to create two dependent jobs.

Hangfire.AutomaticRetryAttribute|Failed to process the job '123': an exception occurred. Retry attempt 1 of 10 will be performed in 00:00:39.
Hangfire.Storage.DistributedLockTimeoutException: Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the 'Could not place a lock on the resource 'HangFire:MyJobClass.MyJobMethod': The lock request timed out.' resource.
   at void Hangfire.Storage.SQLite.SQLiteDistributedLock.Acquire(TimeSpan timeout)
   at new Hangfire.Storage.SQLite.SQLiteDistributedLock(string resource, TimeSpan timeout, HangfireDbContext database, SQLiteStorageOptions storageOptions)
   at IDisposable Hangfire.Storage.SQLite.HangfireSQLiteConnection.AcquireDistributedLock(string resource, TimeSpan timeout)
   at void Hangfire.DisableConcurrentExecutionAttribute.OnPerforming(PerformingContext filterContext)
   at bool Hangfire.Profiling.ProfilerExtensions.InvokeAction<TInstance>(InstanceAction<TInstance> tuple)
   at TResult Hangfire.Profiling.SlowLogProfiler.InvokeMeasured<TInstance, TResult>(TInstance instance, Func<TInstance, TResult> action, string message)
   at void Hangfire.Profiling.ProfilerExtensions.InvokeMeasured<TInstance>(IProfiler profiler, TInstance instance, Action<TInstance> action, string message)
   at PerformedContext Hangfire.Server.BackgroundJobPerformer.InvokePerformFilter(IServerFilter filter, PerformingContext preContext, Func<PerformedContext> continuation)

Anyway I switched to HangFire.SqlServer and this problem did not occur anymore.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
marce1994commented, Jan 9, 2021

Same here 😦

1reaction
rafibenavicommented, Jan 3, 2021

Happens to us too. once every couple of days this occurs in production … awful

Read more comments on GitHub >

github_iconTop Results From Across the Web

Releases · raisedapp/Hangfire.Storage.SQLite
An Alternative SQLite Storage for Hangfire. Contribute to raisedapp/Hangfire.Storage.SQLite development by creating an account on GitHub.
Read more >
Hangfire with Sqlite Storage executing multiple instances ...
I am using SQLite as storage for Hangfire with default worker count of 20. I have a recurring job scheduled to run every...
Read more >
Topics tagged recurring
Distributed Lock Timeout Exception - Timeout expired ... Hangfire with Sqlite Storage executing multiple instances of recurring jobs.
Read more >
Hangfire.Storage.SQLite 0.3.0
An Alternative SQLite Storage for Hangfire.
Read more >
Hangfire causing locks in SQL Server
It seems like Hangfire is locking our DB rendering whole DB unusable. ... well as all jobs failing with "DistributedLockTimeoutException", ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found