Azure-functions-host: Get 502 Error in ~2min, but function is still running.

Created on 20 Jan 2018  路  4Comments  路  Source: Azure/azure-functions-host

Investigative information

Repro steps

This function calcs prime numbers, the count of numbers passed in 'calc' parameter
When I run it like https://functionapp20180120115220.azurewebsites.net/api/Calc1?calc=30000
in ~2 mins I got
502 Bad Gateway. The specified CGI application encountered an error and the server terminated the process. ARRAffinity c9b88f86b83de50e291e31118f8f5e1ba964de7beca6a03b0130da4ad18abbe4 functionapp20180120115220.azurewebsites.net / true
When I go to the portal I see that function still is running and eventually it succeeded in ~150 sec.

Expected behavior

Function MUST not return 502 error in 2 minutes.

Related information

I tried the same code for 1.0 runtime and it works and I didn't see 502 error for such period of time.
I run requests several times and using different tools.

question

Most helpful comment

@christopheranderson, @tdykstra thanks for clarification, however still have questions:

  1. If this is by design, why local development of azure functions with VS2017 didn't get such appearance. I can execute my functions locally beyond 120 sec for http. I understand that it's not quite good idea compare local and cloud versions, but my point is : as developer I want to have the same behavior locally as in the cloud. It can lead to some not good implications at production once my tests passed locally.
  2. Once I get this 502 error I expect that my function failed. In fact, when I go to "Monitoring" I see that it is still running and eventually succeeded. As I got this, I will charge for time function really consuming resources, i.e. number from "Monitoring" tab. There are two issues I see: 1 - with 502 error you notify client that function failed, it leads me to re-run the same function or do something else, but in fact server cheats me. Not very good. 2 - I will be charged more than I would expect. The question is: are you going to do something with this, i.e. make it more clear to client understand what happened, terminate function once response with 502 was sent ?
  3. I'll be really appreciate if you point me out to doc where this limit was added, if it was. If not, please, make it and add it, because it is not obvious. At the moment, I know this limitation, but I'm sure other people don't. Please don't waste other people time in understanding what limits Azure functions have and add clear separate doc with all info.
    thanks,

All 4 comments

Sorry if this wasn't made clear. + @tdykstra who might be able to confirm what our docs say.

For HTTP Functions, they must complete within ~2 minutes or our gateway will timeout. It's recommended you follow async patterns with HTTP and return a location where they can ping the status of that request.

For non-HTTP Functions, they can go up to 10 minutes.

This is as designed.

We have minimal v2 info in our docs right now, but we recently added a Limits section in the HTTP/Webhook binding ref doc that seems like an appropriate place to add a note like this.

@christopheranderson please see https://github.com/MicrosoftDocs/azure-docs-pr/pull/31958 - I added this note without flagging it as v2 only.

@christopheranderson, @tdykstra thanks for clarification, however still have questions:

  1. If this is by design, why local development of azure functions with VS2017 didn't get such appearance. I can execute my functions locally beyond 120 sec for http. I understand that it's not quite good idea compare local and cloud versions, but my point is : as developer I want to have the same behavior locally as in the cloud. It can lead to some not good implications at production once my tests passed locally.
  2. Once I get this 502 error I expect that my function failed. In fact, when I go to "Monitoring" I see that it is still running and eventually succeeded. As I got this, I will charge for time function really consuming resources, i.e. number from "Monitoring" tab. There are two issues I see: 1 - with 502 error you notify client that function failed, it leads me to re-run the same function or do something else, but in fact server cheats me. Not very good. 2 - I will be charged more than I would expect. The question is: are you going to do something with this, i.e. make it more clear to client understand what happened, terminate function once response with 502 was sent ?
  3. I'll be really appreciate if you point me out to doc where this limit was added, if it was. If not, please, make it and add it, because it is not obvious. At the moment, I know this limitation, but I'm sure other people don't. Please don't waste other people time in understanding what limits Azure functions have and add clear separate doc with all info.
    thanks,

@Alezis The note will go here. It has to go through review first, so it may be a few days before it shows up in the doc.

Was this page helpful?
0 / 5 - 0 ratings