Problem:
I am experiencing an issue where the job is stuck in a processing state and all the jobs will be stuck due to that one job. If there is a way to refresh a worker if it got stuck somehow, it may fix the issue of infinite stuck.
Version Details: The issue was also happening when we were using SQL Server instead of Redis for Hangfire.
Hangfire.Pro (2.6.1.1)
Hangfire.Pro.Redis (2.6.1)
All the Information about the problem:
- Randomly Jobs will be stuck in Processing State then that worker will be stuck and will not pick new jobs from the queue even if we delete the stuck job.
- Issue will go away after restarting the service.
- Sometimes Job with 15 minutes will run successfully but sometimes it will be stuck in a job which should only take 2 or 3 minutes.
- In Logs we can see Transport Level (Database Error) errors multiple times. Can it be the cause of stuck if yes then how to make hangfire not to stuck and process the next job?
- Recently we thought, this might be happening due to an uncaught exception in our code and then we fixed that and it is still doing the same thing.
Stuck in Processing Screenshot:
State Transition Screenshot: