Azure function intermittent error during cold start after converting to .NET 8 isolated worker

Ralph Barton 55 Reputation points
2024-06-19T07:27:45.3233333+00:00

I have an Http Trigger Azure function that has been working fine for the past 2 years. It is an Azure Function running on a Windows Consumption App Service Plan. I recently updated from .net6 in-process to .net8 isolated worker model. After the upgrade to isolated worker, I am now seeing intermittent errors when calling the function. The function seems to crash after a cold start and errors are written to AppInsights. Calling the function a second time a few seconds later (typically 15 seconds) - the call will succeed and then subsequent calls will generally work for a while. Then we will typically see another error after the next cold start - although not always - sometimes it works fine.

This problem did not exist before migrating to the isolated worker. I have upgraded to all the latest NuGet packages but still the problems persist. I have seen other people posting similar issues after upgrading to the isolated worker model but I've not managed to find a resolution for this as yet.

I've got a lot of Azure Functions running on Linux Consumption Plans and have not seen this error on any of them - just this Windows one.

The stack trace includes a number of exceptions with the following error messages:

  • "Timed out waiting for the function start call. Invocation: 'f5750d96-7cf5-4d66-86ff-9a229e497006'."
  • An attempt was made to access a socket in a way forbidden by its access permissions.
  • Failed to proxy request with ForwarderError
  • Exception while executing function: Functions.CreatePdfDocument
  • System.Net.Sockets.SocketException at Yarp.ReverseProxy.Forwarder.HttpForwarder+
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,073 questions
Azure Startups
Azure Startups
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Startups: Companies that are in their initial stages of business and typically developing a business model and seeking financing.
370 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Dmitriy Konyayev 65 Reputation points
    2024-07-01T13:55:59.3833333+00:00

    I had the same issue. Found this article https://stackoverflow.com/questions/76952125/isolated-function-app-not-responding-to-http-calls

    In my case, I commented out one item in host.json, which started to cause the issue. host.json cannot have comments (starting with some version of Azure Function)


  2. Dmitriy Konyayev 65 Reputation points
    2024-07-02T14:41:09.2433333+00:00

    Just for reference here's my host.json. For the last 12 hours, I only had 3 traces in my App Insights logs, all valid warnings.

    {
      "version": "2.0",
      "logging": {
        "applicationInsights": {
          "samplingSettings": {
            "isEnabled": true,
            "maxTelemetryItemsPerSecond": 20,
            "excludedTypes": "Request;Exception"
          },
          "enableLiveMetricsFilters": true,
          "enableDependencyTracking": true
        },
        "logLevel": {
          "default": "Information",
          "Function": "Information",
          "Host.Aggregator": "Warning",
          "Azure.Core": "Warning",
          "Azure.Storage.Queues": "Warning",
          "Azure.Storage.Blobs": "Warning",
          "Host.Controllers.Host": "Warning",
          "Microsoft.AspNetCore.Mvc.StatusCodeResult": "Warning",
          "Microsoft.AspNetCore.Mvc.ChallengeResult": "Warning",
          "Microsoft.Azure.WebJobs.Hosting.OptionsLoggingService": "Warning"
        }
      }
    }
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.