Hangfire.Storage.SQLite icon indicating copy to clipboard operation
Hangfire.Storage.SQLite copied to clipboard

.net 6 Hangfire.Storage.SQLite.SQLiteDistributedLock

Open kevinperezbancoserfinanza opened this issue 3 years ago • 1 comments

Category: Hangfire.Storage.SQLite.SQLiteDistributedLock EventId: 0

Unable to update heartbeat on the resource 'HangFire:job:1201:state-lock'. The resource is not locked or is locked by another owner.

Category: Hangfire.Storage.SQLite.SQLiteDistributedLock EventId: 0

Unable to update heartbeat on the resource 'HangFire:job:1199:state-lock'. The resource is not locked or is locked by another owner.

Category: Hangfire.Storage.SQLite.SQLiteDistributedLock EventId: 0

Unable to update heartbeat on the resource 'HangFire:job:1199:state-lock'. The resource is not locked or is locked by another owner.

How fix this error?

in .net core 2.1, 2.2 no occurs this error. Only in .net 6

I have the same issue, any other fix than migrating to SQL Server 2022 Express?

tomasfil avatar Feb 19 '23 19:02 tomasfil

I am using it with .Net 7 and I don't have this problem, is there a way to see your source code? Thanks

SignorLuigi avatar Feb 19 '23 19:02 SignorLuigi

Unfortunately I cannot share repository, since it is corporate software. I am only using AddOrUpdate scheduled tasks, which .Enqueue anither tasks.

I have 3 scheduled tasks

One will every minute Enqueue approx another 53.

And the other two run once a day at midnight.

It just sometimes happen and sometimes dont.

But all still seem working, maybe it should be warning and not error?

tomasfil avatar Feb 19 '23 19:02 tomasfil

Okay, it originates from here. It seems the whole code in that file is not thread safe: https://github.com/raisedapp/Hangfire.Storage.SQLite/blob/32b31a525678efd0431845d3195217c02bda6fcc/src/main/Hangfire.Storage.SQLite/SQLiteDistributedLock.cs#L233

tomasfil avatar Feb 19 '23 19:02 tomasfil

We are also having same problem, almost same situation, like one recurring job enquing multiple background jobs

We are using, Hangfire -1.7.32 Hangfire.Storage.SQLite - 0.3.3

kalai-logicsoft avatar Apr 11 '23 05:04 kalai-logicsoft

Fixed it with version 0.4.0 of the library.

felixclase avatar Dec 31 '23 00:12 felixclase