question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Distributed lock exception - 0.3.0

See original GitHub issue

Still randomly getting distributed lock exception. Hangfire.Storage.SQLite version: 0.3.0 Hangfire.Core version: 1.7.22

Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the 'Could not place a lock on the resource 'HangFire:extension:job-mutex:lock:StatusUpdateJob': The lock request timed out.' resource. at Hangfire.Storage.SQLite.SQLiteDistributedLock.Acquire(TimeSpan timeout) at Hangfire.Storage.SQLite.SQLiteDistributedLock..ctor(String resource, TimeSpan timeout, HangfireDbContext database, SQLiteStorageOptions storageOptions) at Hangfire.Storage.SQLite.HangfireSQLiteConnection.AcquireDistributedLock(String resource, TimeSpan timeout)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
fnajera-rac-decommented, Jan 7, 2022

See #41

2reactions
fnajera-rac-decommented, Jan 7, 2022

After some testing, I think the Acquire() logic is flawed. Why would you extend an existing lock (which it’s not yours) each time you try to Acquire() it (because of the call to .Update())? This makes it impossible to acquire a lock which is already taken but expiring - we are extending its expiration date artificially each time. And there is already a mechanism in place to extend the lock by its owner (the heartbeat).

Also: the lock in the database has no concept of ‘owner’. If it did, the problem above (extending a lock you don’t own) would have never happened in the first place.

I’ll try to work on this and make a PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Distributed Lock Timeout Exception - Timeout expired
Hello Everyone, I have a DistributedLockTimeoutException. Below are the details. Issue : When a Hangfire job is running and is not yet ...
Read more >
PALs
Easy distributed locking using PostgreSQL Advisory Locks. ... If code inside a lock accidentally throws an exception (and .release() is not called)?.
Read more >
distributed locking - npm search
Distributed locking using PostgreSQL advisory locks ... A general purpose distributed locking library built for AWS DynamoDB. dynamodb · distributed · lock.
Read more >
malkusch/lock
This method guarantees that the code is only executed by one process at once. Other processes have to wait until the mutex is...
Read more >
distributed-locking
Distributed read/write locking based on MongoDB, designed to make GridFS safe for concurrent access. local_offermongodb, gridfs, locks, mongo, grid, ...
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