ahydrax / Hangfire.PostgreSql

Alternative PostgreSql Storage Provider for Hangfire
https://www.nuget.org/packages/Hangfire.PostgreSql.ahydrax/
Other
19 stars 7 forks source link

Locks are not cleaned up when a BackgroundJobServer dies #25

Closed jessemcdowell-AI closed 3 years ago

jessemcdowell-AI commented 3 years ago

I've been testing the changes in https://github.com/ahydrax/Hangfire.PostgreSql/pull/24, but have found a problem. When a lock is acquired and the application dies without running it's cleanup routine, it appears that nothing is cleaning up the lock.

Steps to reproduce:

  1. Start the application, wait for recurring job to start
  2. Kill the application without allowing BackgroundJobServer.Dispose() to execute
  3. Start the application again

In this case, the lock will remain in place for 20 minutes (value of DistributedLockTimeout), instead of 2 minutes (ServerTimeout) as I would expect.

jessemcdowell-AI commented 3 years ago

When I originally reported this, I excluded that I'd sent the InvisibilityTimeout property on PostgreSqlStorageOptions, and it now seems that has something to do with the locks not getting cleaned up. Of course I realized that after creating the issue...

jessemcdowell-AI commented 3 years ago

After a bit more testing, I don't think I actually capture the problem I'm experiencing. I'll close this for now and create a new issue if I can isolate it better.