# The timeout elapsed prior to obtaining a distributed lock on the 'xxx' resource

**URL:** <https://discuss.hangfire.io/t/the-timeout-elapsed-prior-to-obtaining-a-distributed-lock-on-the-xxx-resource/7717>\
**Category:** bug?\
**Tags:** recurring\
**Created:** [August 25, 2020, 12:11pm UTC](https://discuss.hangfire.io/t/the-timeout-elapsed-prior-to-obtaining-a-distributed-lock-on-the-xxx-resource/7717 "2020-08-25T12:11:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hardboilr](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/hardboilr/32/2211_2.png) [@Hardboilr](https://discuss.hangfire.io/u/Hardboilr)\
**Post date:** [August 25, 2020, 12:11pm UTC](https://discuss.hangfire.io/t/the-timeout-elapsed-prior-to-obtaining-a-distributed-lock-on-the-xxx-resource/7717/1 "2020-08-25T12:11:39Z")

</div>

The timeout elapsed prior to obtaining a distributed lock on the ‘HangFire:lock:recurring-job:xxx’ resource.

Where currently getting this exception on our servers, which prevents them from starting up. Can confirm that this is an issue on both version 1.7.11 and 1.7.12.  
QueuePollInterval is set to TimeSpan.Zero as this has been the recommended setting since version 1.7.0. I suspect this could be the issue. We have bumped into this issue on occasion and our solution has always been to truncate the hangfire tables, but this is not a viable solution as we currently have some critical jobs enqueued.  
Do you guys have any input? - Thanks!

Our SQL configuration looks like this:  
GlobalConfiguration.Configuration.UseSqlServerStorage(\_sqlConnectionName, new SqlServerStorageOptions  
{  
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),  
QueuePollInterval = TimeSpan.Zero,  
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),  
UseRecommendedIsolationLevel = true,  
PrepareSchemaIfNecessary = true, // Default value: true  
EnableHeavyMigrations = false, // Default value: false  
UsePageLocksOnDequeue = true,  
DisableGlobalLocks = true,  
});

---

<div class="post-metadata">

**Author:** ![Dmytro\_Komar](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/dmytro_komar/32/2457_2.png) [@Dmytro\_Komar](https://discuss.hangfire.io/u/Dmytro_Komar)\
**Post date:** [February 19, 2021, 11:36am UTC](https://discuss.hangfire.io/t/the-timeout-elapsed-prior-to-obtaining-a-distributed-lock-on-the-xxx-resource/7717/2 "2021-02-19T11:36:06Z")

</div>

Did you find a way how to fix it eventually?

We also face this issue and can’t really find any solution  
I tried to set QueuePollInterval = TimeSpan.FromSeconds(15) but looks like it become even a little worth
