Closed YukaAn closed 2 years ago
Flush the memory storage when the application changes? MemoryStorage is in-process and cleared when we restart the process after binary updates.
Try using this filter to avoid scheduling a new recurring job execution when previous one is still running – https://gist.github.com/odinserj/a6ad7ba6686076c9b9b2e03fcf6bf74e.
@dchrno : Did you fix this issue ? How ? We are facing a very similar (if not identical) issue with a recurring background job...
Unfortunately, no. We ended up adding a mutex per task as a workaround.
Edit: we have a base class containing this code. "key" is the type name of the recurring task.
if (!_semaphore[key].Wait(100)) // try to aquire mutex
{
log.Debug("{description}: job is already running", description);
return;
}
@dchrno : Thanks for the feedback
This issue still happens in version 1.7.25 and memory storage 1.4.
Edit: I was using Hangfire.MemoryStorage which is NOT the ideal package (and it's creators also said it is not good for production purposes). I updated my main package to Hangfire.Core 1.8.5 and started using Hangfire.InMemory package from @odinserj . But anyways I had to implement a Mutex in C# to handle this multiple starts scenario.
This is still an issue for version 1.7.28 using the MS SQL database as storage
This is still an issue with the latest version as of today, paired with postregsql. In our case we have a machine learning task that can run for days. Those long running jobs start running again after 48 hours and it is always at midnight. Even if we fire the job lets say at noon 2 days ago, after two midnights pass, it starts again and runs concurrently, with its previous incarnation. We tried to remove the schedule and fire them from the dashboard by hand, it still behaves the same.
I have gone through all the open issues here and found that the issue Im experiencing supposed to be solved with v1.5.8. But Im running v1.6.6 and still seeing the similar issue. So the same job will be processed multiple times randomly. I also saw issue #842 describing the same thing. Can someone help me to fix it?
I'm using Hangfire.SqlServer V1.6.6