skip to Main Content

I have migrated from in-process function to isolated worker process(.net6 to .net8).
Before migration I was not getting any timout exception. On lower environments as well app didnt get any timeout and testing was successful. But on production getting "Microsoft.Azure.WebJobs.Host.FunctionTimeoutException".

I haven’t done any code logic changes, just code changes for upgrading. No changes done in host.json
I can increase the timeout value as a solution but I wanted to know why this behaviour has happened?

Please forgive my question structuring.

I have searched the net for such behaviour of function app but not getting anything specific to my question

2

Answers


  1. Microsoft.Azure.WebJobs.Host.FunctionTimeoutException occurs when the function exceeds its timeout limit due to various reasons during the function execution.

    • Check the invocation logs for the detailed errors.

    enter image description here

    To resolve this error, add functionTimeout attribute in host.json.

    • By default, Azure Functions have a timeout of 5 minutes (00:05:00) in consumption plan and can be increase it to 10 minutes(max).
    • In case of Premium and Dedicated plan function app, default timeout is 30 minutes but technically unbounded(-1).

    host.json:

    {
      "version": "2.0",
      "logging": {
        "applicationInsights": {
          "samplingSettings": {
            "isEnabled": true,
            "excludedTypes": "Request"
          },
          "enableLiveMetricsFilters": true
        }
      },
      "functionTimeout": "00:30:00"
    }
    
    • Runtime stack version of Azure function should be .NET 8 Isolated:

    enter image description here

    • Update the packages of the function to latest versions:

    .cproj:

     <ItemGroup>
       <FrameworkReference Include="Microsoft.AspNetCore.App" />
       <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.21.0" />
       <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
       <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.2.0" />
       <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.1.0" />
       <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.0" />
       <PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
       <PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.2.0" />
     </ItemGroup>
    
    Login or Signup to reply.
  2. Try changing the value of FUNCTIONS_WORKER_RUNTIME to dotnet-isolated in local.settings.json. And, if you have hosted the function in Azure, do that in the Environment variables section as well.

    Also, upgrade the .net version to .NET 8 Isolated in the General Settings section of the Configurations, from the Azure portal.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search