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

Ralph Barton 20 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+<SendAsync>d__8.MoveNext

Full diagnostic errors that I am getting are below

{"severityLevel":"Error","outerId":"64590852","message":"An attempt was made to access a socket in a way forbidden by its access permissions.","type":"System.Net.Sockets.SocketException","id":"54290150","parsedStack":[

{"assembly":"System.Net.Sockets, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","method":"System.Net.Sockets.Socket+AwaitableSocketAsyncEventArgs.ThrowException","level":0,"line":0},

{"assembly":"System.Net.Sockets, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","method":"System.Net.Sockets.Socket+AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult","level":1,"line":0},

{"assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable+ConfiguredValueTaskAwaiter.GetResult","level":2,"line":0},

{"assembly":"System.Net.Sockets, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","method":"System.Net.Sockets.Socket+<<ConnectAsync>g__WaitForConnectWithCancellation|277_0>d.MoveNext","level":3,"line":0},

{"assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw","level":4,"line":0},

{"assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess","level":5,"line":0},

{"assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification","level":6,"line":0},

{"assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable+ConfiguredValueTaskAwaiter.GetResult","level":7,"line":0},

{"assembly":"System.Net.Http, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","method":"System.Net.Http.HttpConnectionPool+<ConnectToTcpHostAsync>d__98.MoveNext","level":8,"line":0}]}



Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,543 questions
{count} votes