Azure Function App timing out at ~8 hours despite functionTimeout set to -1

Dustin Chavez 60 Reputation points
2025-12-09T16:29:00.0533333+00:00

I have an Azure Function App that performs a long-running operation (12-24 hours) to move documents to Azure Blob Storage. Despite setting "functionTimeout": "-1" in my host.json, the function stopped executing after approximately 8 hours before completing the batch move of documents via API calls. I do not see the invocation in the invocations tab as well which leads me to believe it has something to do with timing out since no errors had stopped execution.

Configuration:

  • Function timeout setting: "functionTimeout": "-1" in host.json
  • Expected execution time: potentially 12-24 hours
  • Actual execution time before stopping: ~8 hours
  • Operation: Moving documents to Azure Blob Storage

Question:

  1. What would be causing the function to stop at ~8 hours despite the unlimited timeout configuration?

Additional context:

  • Hosting plan: Elastic Premium EP1
  • Function runtime version: 4.1045.200.25555
  • Trigger type: Event Grid trigger on Blob Creation
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
{count} votes

Answer accepted by question author
  1. Rakesh Mishra 3,955 Reputation points Microsoft External Staff Moderator
    2025-12-09T16:56:40.6666667+00:00

    Hi @Dustin Chavez ,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    Why your function likely stopped at ~8 hours:

    • functionTimeout = "-1" is valid and indicates unbounded execution in host.json. That only controls the Functions host timeout. It does not guarantee your process will never be recycled by the platform.
    • The Elastic Premium plan supports unbounded durations, but the platform still has behaviors that can terminate workers: an idle timer that stops a worker after 60 minutes with no executions, scale-in that can shut down a worker (60 minutes grace), and managed shutdowns during platform updates (10 minute grace). Those platform lifecycle events are explicitly called out in the Premium plan docs. A long single invocation that sits on one worker is therefore fragile.
    • For HTTP triggers there is an extra constraint (load-balancer idle/idle-timeout) that limits single-request response time regardless of functionTimeout (see the Functions hosting/scale page). For long work you should avoid relying on a single synchronous HTTP response.

    Regardless of the function app time-out setting, 230 seconds is the maximum amount of time that an HTTP triggered function can take to respond to a request. This is because of the default idle time-out of Azure Load Balancer. For longer processing times, consider using the Durable Functions async pattern or defer the actual work and return an immediate response.

    Possible Solutions/Suggestions:

    1. Move long-running jobs to Durable Functions (orchestrator + activities) for reliability.
    2. Break the job into small, idempotent chunks and process via queues/messages.
    3. Avoid long synchronous HTTP responses — return 202 Accepted and run work asynchronously.
    4. Configure minimum/pre-warmed instances (minimumElasticInstanceCount) on Elastic Premium to reduce scale-in.
    5. Add checkpointing and retries so progress survives host restarts or failures.
    6. Enable Application Insights, streaming logs and check Activity Log/Kudu to find platform recycles.
    7. Consider running very long single-process work on a VM/container or WebJob if Functions isn’t suitable.
    8. Test with shorter runs and correlate logs to identify the exact platform event causing termination.

    Reference:

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Q&A Assist
    2025-12-09T16:30:17.54+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The issue you're experiencing with your Azure Function App timing out after approximately 8 hours, despite setting "functionTimeout": "-1", could be related to several factors:

    1. Platform Limitations: Even though you have set the function timeout to unlimited, Azure Functions have certain platform constraints. For instance, the Elastic Premium plan has a default execution timeout that may not be overridden by the host.json setting. It's important to confirm the specific limits for your hosting plan.
    2. Idle Timeout: Azure Functions may have an idle timeout that stops the execution of a function if it has been inactive for a certain period. This could be contributing to the premature stopping of your function.
    3. Health Monitoring: If the function is not responding or is failing health checks, it could lead to the function being recycled or stopped. Ensure that your function is actively processing and not getting into a state where it is considered unhealthy.
    4. Event Grid Trigger Behavior: Since your function is triggered by an Event Grid event, ensure that the events are being processed correctly and that there are no issues with the event delivery that could cause the function to stop executing.
    5. Resource Constraints: The number of resources allocated to your function app might also affect its execution time. If the app is hitting resource limits, it could lead to unexpected behavior.

    To resolve the issue, consider reviewing the Azure Functions documentation regarding execution limits and best practices for long-running functions. You may also want to implement a strategy to break down the long-running operation into smaller, manageable tasks that can be executed within a shorter time frame.


    References:

    0 comments No comments

Your answer

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