0

I have a reproducible here. Let's say if the function throws out of memory error. I expect the subsequent calls to succeed (providing isolation across calls). But I dont find that happening

Consider this azure function:

import com.microsoft.azure.functions.*;
import com.microsoft.azure.functions.annotation.AuthorizationLevel;
import com.microsoft.azure.functions.annotation.FunctionName;
import com.microsoft.azure.functions.annotation.HttpTrigger;

import java.util.ArrayList;
import java.util.Optional;
public class Function2 {

    @FunctionName("HttpExample2")
    public HttpResponseMessage run(
            @HttpTrigger(
                    name = "req",
                    methods = {HttpMethod.GET, HttpMethod.POST},
                    authLevel = AuthorizationLevel.ANONYMOUS)
                    HttpRequestMessage<Optional<String>> request,
            final ExecutionContext context) {
            final String query = request.getQueryParameters().get("name");

            if("oome".equals(query)) {
               ArrayList<String> memory = new ArrayList<>();
               for (int i = 0; i < 100_000_0000; i++) {
                  memory.add("=========================");
               }   
            }
            return request.createResponseBuilder(HttpStatus.OK).body("ok").build();
    }
}

On making curl call

 //below succeeds    
> https://xxxx.azurewebsites.net/api/HttpExample2
// below throws OOME
> curl https://xxxx.azurewebsites.net/api/HttpExample2?name=oome 
>
> //expect the below to respond , but it doesnt
> https://xxxx.azurewebsites.net/api/HttpExample2

In fact, if I re-attempt querying after a time gap, it still doesn't respond.

The function only behaves normally post a restart. Is this a bug?

Jatin
  • 31,116
  • 15
  • 98
  • 163

0 Answers0