F&F job keeps changing server and worker and never ends

Hi, I’m using HangFire 1.6.15 to convert and watermark videos uploaded by users. On the development machine everything goes smooth, on the production server for videos larger than 30Mb the job keeps changing either worker or server every minute endlessly and never gets completed. I can’t really understand what causes this behaviour, any help would be appreciated.

Anything unusual in the logs?

Nothing unusual at all

What storage do you use? Are you using any non-default settings for storage/server?

I use SqlServerStorage, nothing unusual, this is my Startup class:

GlobalConfiguration.Configuration.UseSqlServerStorage(“DefaultConnection”);
var authenticationFilter = new HangefireAuthorizationFilter();
var options = new DashboardOptions
{
Authorization = new { authenticationFilter }
};
app.UseHangfireServer();
app.UseHangfireDashboard(“/hangfire”, options);

It looks like you don’t have any logger set up, do you?

If you’re running ASP.NET Core with Hangfire.AspNetCore package, the logger is set up automatically by services.AddHangfire() method (you just may need to adjust logging level in the appsettings.json).
Otherwise you need to configure it manually (by calling a corresponding extension method on GlobalConfiguration, e.g. UseColouredConsoleLogProvider() or UseLog4NetLogProvider()) before you can see any exceptions logged.

Alright, the app is running under .NET 4.6.1, I’m gonna set up Log4Net and post the results back in here asap.

Sorry for the late reply but i was caught on another problem. I set up Log4Net and initially set the level to “WARN” but the log file didn’t show anything, so i set the level to “ALL” and i got just a bunch of “DEBUG” messages, mostly reading “worker #xxxxxx stopped” and “worker #xxxxxx was stopped due to a shutdown request”. I noticed none of the workers mentioned in the log file match the workers i’ve seen in the HF job’s state page, i don’t know if this is of any help.

Are you running your jobs inside IIS process? It looks like IIS process recycling to me.

http://docs.hangfire.io/en/latest/deployment-to-production/making-aspnet-app-always-running.html

Yes it’s running under IIS, I’m gonna give it a try and let you know what comes up, thank you for now :slight_smile: