Azure functions - Functions host is not running

Viewed 1651

I keep getting an error 503 on my health checks for my azure functions, it says error 503. Functions host is not running. It's very inconsistent and only happens once every few days, I'm on the consumption plan but looking at whether a premium plan would fix the issue.

3 Answers

In Azure Functions, 503 service unavailable causes for the reasons like:

  • Function host is down/restarting

  • Platform issue due to the backend server not running/ allocated

  • Memory leak/issue from the code causing the backend server to return 503

To get some insights about the function host related issues, take a look into the "Diagnose and solve problems" blade in the Function app and select the "Function app down or reporting" detector. This detector will show all the diagnostic information about the function app and its infrastructure.

enter image description here

  • 503 service unavailable comes sometimes when the function takes more than 5 minutes to return an HTTP response in consumption plan. Regardless of the function app timeout setting, 230 seconds is the maximum amount of time that an HTTP triggered function can take to respond to a request. For longer processing times, use Azure Durable Functions async pattern. Refer to this link.

  • We should not change the app settings frequently in the production environment. If you update the app settings, the app will be restarted. In this cases, you will get 503 error. In order to avoid this, you can use the slot feature


Function host is not running

This issue happens due to invalid host.json. To diagnose, it's best to look at the function host logs from the log stream in Azure Portal.

Few errors and resolutions of this kind of error are:

  • If you have any startup.cs class, check if any error available where the errors were logged in Application Insights.
  • One of the reason is a missing app setting. Ensure you publish local settings as well.

If it didn't help then one of the reason could be platform issue and to confirm this we need to look into the backend logs on what was happing during that time resulting in 503 errors.
You can create the support ticket with Microsoft to assist you further.

According to this thread, one possible cause of 503 service-unavailable responses is when the service consumes more memory than what is available under the consumption (serverless) plan, causing the service to be evicted. Switching to a dedicated hosting plan can fix this issue. According to Microsoft's documentation, it appears that the function is allowed a maximum of 1,536MB of memory at one time. Of course, it could also be the case that your function is exceeding any of the other service limits associated with that plan, so my advice would be to add instrumentation and code defensively.

Got 503 after redeploying an Azure function.

Turned out the Python version had defaulted to 3.6, updated to 3.9 and started working.

I was using terraform and github actions

Related