'Azure function timing out at max interval, while invocation has not reached max interval

Very odd situation that I've realized is-- my Azure Function is timing out every 40 minutes... which is what my functionTimeout parameter is set to in my host.json file: "functionTimeout": "00:40:00"

When I go and actually trace a timeout error, the invocation has not been running for 40 minutes. It seems that my Azure Function App is just set on timing out every 40 minutes, regardless of the actual invocation time.

My Azure function is also not running concurrently. I've scaled down the amount of VM's running the script to 1 and my batchszie is set to 1: "queues": { "batchSize": 1 }

In between the 40 minute intervals, invocations are made and data is making it into my DB. Which, would not be the case if there was an invocation that was actually stuck. At least from my understanding, if it's not running concurrently. It seems whatever invocation is running at the 40 minute mark will get interrupted with a timeout. How exactly can I fix this?



Solution 1:[1]

Here are some possibilities of this issue:

Increase the function timeout

  • If you are using Consumption plan, try to change into Premium or Dedicated plan because we can increase the maximum timeout in those plans. enter image description here

DB Connection Timeout

  • If your DB connection, is idle for more than 30 minutes, the connection will be closed.
  • If you're connected from SSMS or any other applications to the Azure SQL DB for longer than 30 minutes without any active request, your session will timeout.

Using Durable Function

  • You can use Durable function to run the multiple functions in parallel and then wait for all functions to finish.

Reference

Improve the performance and reliability of Azure Functions

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SuryasriKamini-MT