Open brettsam opened 6 years ago
It might be completed unrelated, but I noticed that post talked about how an app domain might fail to unload if stuck in a finalizer, and this issue reported recently has a edge.js finalizer stack: https://github.com/Azure/azure-functions-host/issues/2690
I think we need to consider a design that will sometimes call process.exit, and the question is what heuristic should we use.
The issue described here sounds like it would be addressed by https://github.com/Azure/azure-functions-host/issues/2972 as @paulbatum mentions above.
It appears there are cases where calling
HostingEnvironment.InitiateShutdown()
will not stop all background threads. This means that if someone is in this situation and has exceeded the thread count threshold, they will infinitely repeat starting/stopping the host (due to the Health Monitor shutting it down). Only restarting the site manually will fix it.Found this which has some examples: https://stackoverflow.com/questions/4432141/how-to-properly-unload-an-appdomain-using-c/5863164
I'm waiting on a concrete sample from this customer. When we have it, I'll do some more investigation into whether this is something we can help with.