Azure / Azure/azure-functions-host

HttpTrigger (input) giving 502s when Always On enabled (Azure Functions V2)

Open
#3,794 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

We are currently using Azure Functions V2 in a dedicated app service plan. It has an HttpTrigger for input.

We noticed that when we have Always On switched on, we get quite a lot of 502 errors when the function is under load. Whilst that in of itself is annoying, what is even more weird is that the function appears to have been run anyway. The function we are using output onto a Service Bus Queue. We disabled all the functions reading from the queue and hit the endpoint 800 times. Even with quite a number of 502s (without retries) the queue length was also 800.

At this point Always On was still on. Guessing it was some sort of scaling issue, we put the function down to having one maximum concurrent request. This resulted in no 502s but obviously a significant performance decrease.

We then put it may to default but turned Always On back to off. We then got high performance and no 502s.

So main questions:
- Why does having Always On switched on cause the functions to return 502.
- Why when they return 502 do they appear to be running.

#### Investigative information

It's hard to share this. I don't want to send over my function name but the most I can give it a timestamp. I cannot get any IDs from the requests when I'm load testing it.

Is there another way to privately share the information?

#### Repro steps

Provide the steps required to reproduce the problem:

1. Create a Function App with a function that has an HttpTrigger Input with Service Bus Queue Output.
2. Set the app to have Always On switched on.
3. Load test the function

#### Expected behavior

Function scales, waiting for each function to load and then processing the requests. Any failures are lost (if there needs to be any)

#### Actual behavior

Function scales but throws a lot of 502s. It also seems to be running the functions on the 502s which means retying things becomes more difficult for calling application without adding duplicates onto the queue.

#### Known workarounds

Switch off Always On.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported load test: an HTTP-triggered Azure Functions V2 app with Service Bus Queue output, Always On enabled, and 800 requests. Compare 502 responses, queue length, and function execution with Always On disabled or concurrency limited; done means explaining the duplicate-looking executions and identifying a verified fix or documented limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
backend, cloud
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.