Distributed lock exception - 0.3.0
See original GitHub issueStill 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:
- Created 2 years ago
- Reactions:4
- Comments:7 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
See #41
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 toAcquire()
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.