How does Hangfire handle bad actors?

We have a project that makes use of 3rd party PDF / image processing DLLs. These tools sometimes behave badly (especially when running in IIS), they hang, get in infinite loops, crash hard-core (take down IIS). We mitigate this somewhat now with a custom “task and thread in a new appdomain” model with timeouts, but its not ideal. Sometimes these assemblies use non-managed code or do odd things with IE / Gecko and can crash the parent process.

My question is, how does Hangfire handle this? Can we say - “don’t let this job run more than 30 seconds”? And what happens if things got REALLY wrong in a job process?

No answers yet? I follow-up then, is there an easy pattern to have my async job call an EXE? I am trying to decide if I should go with Hangfire or Azure WebJobs. WebJobs lets you call an EXE which is a nice way for me to compartmentalize the execution into a safe process that can be killed.


The Hangfire job methods are regular .NET methods. You can do basically anything, including calling exe’s.