azure-functions-host icon indicating copy to clipboard operation
azure-functions-host copied to clipboard

Random "The service is unavailable." and "Azure Functions runtime is unreachable" errors

Open Arjan321 opened this issue 3 years ago • 148 comments

We have been running a couple of Azure Functions in various subscriptions, and every once in a while (about once a week), the entire Azure Function goes down and reports "The service is unavailable." when accessing the Function-app via HTTP and reports "Azure Functions runtime is unreachable" in the Azure Portal.

HTTP response: image

Portal: image

The issue appears randomly, without any changes in our end (no deployment, etc.) and also resolves randomly without any interaction from our side.

In the "Activity log" an error is written for the job "Sync Web Apps Function Triggers" with status "Failed":

        "statusCode": "BadRequest",
        "statusMessage": "{\"Code\":\"BadRequest\",\"Message\":\"Encountered an error (ServiceUnavailable) from host runtime.\",\"Target\":null,\"Details\":[{\"Message\":\"Encountered an error (ServiceUnavailable) from host runtime.\"},{\"Code\":\"BadRequest\"},{\"ErrorEntity\":{\"Code\":\"BadRequest\",\"Message\":\"Encountered an error (ServiceUnavailable) from host runtime.\"}}],\"Innererror\":null}",

The issue seems quite similar to #8519, however we are running Linux.

This is causing quite some problems, since we are no longer able to provide reliable service to our end-users.

Investigative information

  • Timestamp: Wednesday, 27 July 2022, 07:47, Coordinated Universal Time (UTC)
  • Function App version: V4
  • Function App name: Please use Invocation ID
  • Function name(s) (as appropriate): All functions within the app are non-working
  • Invocation ID: None of the functions work, but to find our function-app: 2022-07-27T08:05:13.773Z - e95ba16f-f2a2-420c-bcfd-4891d54198ae
  • Region: West-Europe

Repro steps

None that we can find

Expected behavior

Always work

Known workarounds

None

Related information

Hosting Model: Consumption Plan OS: Linux Version: V4 Hosting Model In-Process Language: C#/dotnet6 Configuration:

  • WEBSITE_RUN_FROM_PACKAGE points to a valid file on a storage account
  • WEBSITE_MOUNT_ENABLED: 1
  • WEBSITE_ENABLE_SYNC_UPDATE_SITE: false
  • WEBSITE_CONTENTAZUREFILECONNECTIONSTRING: Valid keyvault reference toa a storage account
  • SCM_DO_BUILD_DURING_DEPLOYMENT: false
  • FUNCTIONS_WORKER_RUNTIME: dotnet-isolated
  • FUNCTIONS_EXTENSION_VERSION: ~4
  • AzureWebJobsDisableHomepage: true

Arjan321 avatar Jul 27 '22 08:07 Arjan321

Hi Arjan32,

Normally this error message is related with misconfiguration.

Please take a look the bullets below:

  • Add the variable AzureWebJobsStorage and add the value of the connection string from the Storage Account Reference:

    • https://docs.microsoft.com/en-us/azure/azure-functions/functions-app-settings#azurewebjobsstorage
  • Double check the value of the variable WEBSITE_RUN_FROM_PACKAGE Reference:

    • https://docs.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package
    • https://github.com/projectkudu/kudu/wiki/WEBSITE_RUN_FROM_PACKAGE-and-WEBSITE_CONTENTAZUREFILECONNECTIONSTRING-Best-Practices

wbail avatar Aug 27 '22 17:08 wbail

As mentioned in then original issue, Those values point to valid values.

Given the extreme randomness of both the issue appearing and resolving itself, I hardly doubt any setting on our end is responsible.

Arjan321 avatar Aug 28 '22 19:08 Arjan321

Hi, is there any update on this issue? I am seeing the same random service unavailable issues. Thanks

gilesmatthews avatar Sep 21 '22 09:09 gilesmatthews

Same issue here, completely random. Waiting on a fix for a while now.

rlucassen avatar Sep 21 '22 12:09 rlucassen

Sorry for you guys, but I'm happy to read this... thought I was going crazy. What region do you guys have your Azure Functions running? Ours are in West Europe.

LuckyLub avatar Sep 21 '22 13:09 LuckyLub

Sorry for you guys, but I'm happy to read this... thought I was going crazy. What region do you guys have your Azure Functions running? Ours are in West Europe.

Mine are running in West Europe as well, same for @Arjan321

rlucassen avatar Sep 21 '22 13:09 rlucassen

same region West Europe

tomabg avatar Sep 21 '22 15:09 tomabg

this also breaks terraform deployment...as we are on test only we will try different region soon

tomabg avatar Sep 21 '22 15:09 tomabg

this also breaks terraform deployment...as we are on test only we will try different region soon

Curious to know if other regions do work.

Heard that Microsoft is doing updates in the West Europe region around next week

rlucassen avatar Sep 22 '22 10:09 rlucassen

We also deploy with Terraform BTW. Changing the location to Central US seems to do the trick.

LuckyLub avatar Sep 22 '22 10:09 LuckyLub

Any news on this?! We are experiencing the same problems in West Europe region

jnekrasov avatar Sep 23 '22 09:09 jnekrasov

Also seeing issue in West Europe region

Ralle1986 avatar Sep 23 '22 10:09 Ralle1986

Sorry for the delay in responding. Yes, there was a regression due to a recent update in the region which caused intermittent errors. The fix rollout has already started and in progress currently. If there are any apps still experiencing failures, could you please share the details and we can double check them. Thanks

balag0 avatar Sep 27 '22 00:09 balag0

Before we move back, can you please confirm when the roll-out is completed?

LuckyLub avatar Oct 04 '22 07:10 LuckyLub

any news on that topic or link to the issue to see if its solved ?

lightwaver avatar Oct 06 '22 05:10 lightwaver

@balag0 any update?

LuckyLub avatar Oct 10 '22 08:10 LuckyLub

@surgupta-msft, @balag0, any updates? Just tried to redeploy to West-Europe, still running into random "The service is unavailable." errors Running the same functions in North-Europe works just fine.

LuckyLub avatar Oct 13 '22 11:10 LuckyLub

Just had contact with Azure's Help + Support. I presented the problem, it seemed to be known. However, they will collect some logs from my Azure Functions and look further into it. They are still working on upgrading the services in West-Europe. Currently it was advised to use another region.

LuckyLub avatar Oct 13 '22 13:10 LuckyLub

I can confirm that it is still occurring

jeroenvermunt avatar Oct 17 '22 13:10 jeroenvermunt

We have had these problems too. We have been in contact with Azure Support and they are saying the following:

" Conclusion: The 503s were detected ONLY on Azure Front End, the Front End instances encountered some unexpected error at that moment and weren’t able to handle the http requests and distributed them to specific workers that were hosting your function app.

.....

Let’s take a closer look at these 2 Front End instances at that time, Front End instance 24 encountered an error when trying to get a worker from the data role, and the same situation for the instance 5.

image image

Unfortunately, this is an underlying platform issue as the Front End is an important component inside of Azure platform, and both the user side and our side cannot have action to interact with it, we apologize for all the inconvenience caused, but please rest assured that I’ve already reflected this to the Microsoft Azure Team and they already know this, we met this kind of issue before. "

^ this has been now several months ago. The fact that these problems are still popping up is disappointing. Also telling us to a different region is also disappointing. We are bound by compliance issues so we cant leave our region as easy.

Rutix avatar Oct 17 '22 13:10 Rutix

Last wednesday we got the message from Microsoft that this issue should be fixed, we already transferred to a premium plan because we got tired of it after 4 months. I'm curious to know if anybody is still encountering this issue in the West-Europe region?

rlucassen avatar Oct 21 '22 07:10 rlucassen

So using premium is a valid work around?

LuckyLub avatar Oct 21 '22 09:10 LuckyLub

So using premium is a valid work around?

Yes upgrading to premium worked for us

rlucassen avatar Oct 21 '22 09:10 rlucassen

So using premium is a valid work around?

If "Throwing money at the problem" counts as a workaround, then yes. This ticket is specifically about the Consumption Plan.

Arjan321 avatar Oct 21 '22 09:10 Arjan321

Just good to know what options are out there.

LuckyLub avatar Oct 21 '22 09:10 LuckyLub

Message from MS:

Product Group is still working on improvement on the west Europe region. Will keep you updated on any progress.

LuckyLub avatar Oct 25 '22 11:10 LuckyLub

I got some messages that we got hit again. We are not entirely sure if it was the same cause as this issue but we had "Service unavailable" a couple of times today in west europe.

Rutix avatar Oct 25 '22 19:10 Rutix

@Rutix I happened upon this thread as well this afternoon, also from The Netherlands, having Functions (Consumption tier) in West Europe. They were unavailable and/or throwing SSL errors. I also could not deploy from VS Code (unavailable)

What fixed it for me is going into the Portal and Restarting my Functions manually.

rdvansloten avatar Oct 25 '22 20:10 rdvansloten

That’s a temporary fix.

LuckyLub avatar Oct 25 '22 20:10 LuckyLub

@rdvansloten sadly that is only a temp fix and also doesn't always work (or takes a long time to recover). The best way would be for the Azure team to fix this asap.

Rutix avatar Oct 25 '22 21:10 Rutix