Azure Container Instance long running web form

aggrojus 0 Reputation points

I have a simple Azure Container Instance that hosts a Remix/React web app. I'm trying to submit an mp4 file to a web service when the form is submitted. It uploads the mp4 file and calls the web service successfully, but it times out with ERR_CONNECTION_RESET waiting for the web service to finish processing. It all works locally. Is there a way to configure the Azure Container Instance to wait longer without resetting the connection?

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
672 questions
{count} votes

1 answer

Sort by: Most helpful
  1. deherman-MSFT 35,556 Reputation points Microsoft Employee


    Azure Container Instances (ACI) themselves do not impose a timeout on outbound connections, so it's likely not the container that's causing the issue. The problem could be due to some other factors such as the web service configuration or even some network settings.

    Let's break down some possibilities:

    1. Web service timeout: Check the configuration of the web service that you're calling. It may have a timeout set which is closing the connection after a certain period. If you have control over this service, try increasing the timeout.
    2. Load Balancer or Proxy timeout: If there's a Load Balancer, Proxy, or some other network component between your ACI and the web service, they might have a timeout configured that's closing the connection. If this is the case, try increasing the timeout on these components.
    3. Client-side timeout: The client making the request (in your case, the web app in your container) might have a timeout set. In many HTTP libraries, there's a way to configure this. For example, in Node.js, you might do something like http.setTimeout(500000); to set the timeout to 500,000 ms (or 500 seconds). Look for a similar setting in the HTTP library you're using.
    4. Azure App Service Plan: If your Azure Container Instance is part of an App Service Plan, you should be aware that the plan itself imposes a 230-second (slightly less than 4 minutes) timeout for requests. Unfortunately, this is a hard limit and can't be configured. If your service consistently takes longer than this to respond, you might need to re-architect your solution to use an async pattern.

    Since it works locally but not in ACI, I would lean toward it being either a network component like a Load Balancer or Proxy (option 2), or the client-side timeout (option 3). So I would check those first.

    Remember, when dealing with long-running requests, it's often better to adopt an asynchronous design pattern. In such a pattern, the client makes a request to start a job, the server starts the job and immediately responds with a "job started" message, and then the client periodically polls the server or waits for a callback to find out when the job is done. This avoids the need to keep a connection open for a long period.

    If you still have questions, please let us know in the "comments" and we would be happy to help you. Comment is the fastest way of notifying the experts.

    If the answer has been helpful, we appreciate hearing from you and would love to help others who may have the same question. Accepting answers helps increase visibility of this question for other members of the Microsoft Q&A community.

    Thank you for helping to improve Microsoft Q&A!

    User's image

    0 comments No comments