I’m running an Umbraco web app and using hangfire to schedule a few tasks. A certain task I’m running is long running (± 5 hours) and Ive noticed that the job restarts every 30 min. Ive included an invisibility timeout value of 6 hours but this doesn’t change anything. I’ve now also upgraded to V 1.5.3 (which apparently solves this problem http://hangfire.io/blog/2015/07/31/hangfire-1.5.0-beta.html#instant-re-queue-for-sql-server) but it’s still happening
Hi, have the same issue. Long jobs just get cancelled and restarted after 30 minutes. No matter what I do… using Hangfire 1.5.3. (thinking of downgrading back to version 1.4.6). I am reverse-engineering the code now to find, where this cancellation happens, but until now no luck…
The problem is probably in the SqlServerJobQueue Dequeue Method, where the JobQueue gets refetched every 30 Minutes. The problem is not that easy to fix, there is some strange behavior happening with transactions. I switched back to 1.4.7 version, which seems to work fine.
I have verified what you are talking about. Unfortunately we cannot go to production with this bug. What’s strange is, in the Sql Server implementation, the Dequeue method is querying for tasks in the job queue that have a null FetchedAt time or a FetchedAt time that occurs before the invisibility time span (which is deprecated). The thing that I find odd is, after searching through the code, I don’t see any place where the FetchedAt column ever gets updated, so I am at a loss for how this query can find candidate tasks properly. Also, that record cannot be updated because it has been effectively deleted within the current transaction.
So, you are absolutely correct, this is a complex problem. The 1.4.7 version does an update on the queue entry and not a delete. I wonder why Oleg changed it?