Job keep processed, never succeed nor failed

I am using Hangfire 1.1.1 and a beginner in c# api/mvc development. On development stage, HF was running good in my web api application, every job is running as expected. When I put my apps in production server, then problem occured. To put it simply, the job is in ‘processing’ mode forever. I look at the detail of the job (in dashboard), and the history entry is always processing, multiple times by different worker.

I guess it has somethng to do with timeout setting somewhere, something like my job/method is blocking longer than any timeout, so then it try to execute the job again without failing it first. The interval between each process/worker is either 5 or 30 minutes.

Any suggestion?


SQL Server storage for Hangfire has so-called invisibility timeout. Looks like your background jobs exceeds the default value, 30 minutes. You can configure it in the folowing way:

var options = new SqlServerStorageOptions
    InvisibilityTimeout = TimeSpan.FromMinutes(30) // default value

var storage = new SqlServerStorage("<name or connection string>", options);

That seems the problem and solution. Though I didn’t expect it really run for more than thirty minutes, must be another bug in my implementation or library I use.

Thank you for your answer.