hangfire-postgres / Hangfire.PostgreSql

PostgreSql Storage Provider for Hangfire
Other
356 stars 132 forks source link

Could not place a lock on the resource 'hangfire:lock:recurring-job:jobid': Lock timeout. #365

Closed duynv7 closed 4 months ago

duynv7 commented 4 months ago

When I use to RecurringJob.AddOrUpdate() in .Net Core it throws an exception: Could not place a lock on the resource 'hangfire:lock:recurring-job:jobid': Lock timeout. How to fix this problem?

Version: Hangfire.PostgreSql: 1.20.8 Hangfire: 1.8.12 Hangfire.Core: 1.8.12 NetCore: 6.0.28

image

azygis commented 4 months ago

You could check to see if hangfire.lock table contains any rows while the app is not running. If there is, clear the table.

That is the most usual cause - happens if the process is killed without allowing it to shut down properly (e.g. killing the process or stopping the debugger which does not wait for the process to finish).

duynv7 commented 4 months ago

You could check to see if hangfire.lock table contains any rows while the app is not running. If there is, clear the table.

That is the most usual cause - happens if the process is killed without allowing it to shut down properly (e.g. killing the process or stopping the debugger which does not wait for the process to finish).

Thanks!