Azure / azure-functions-java-worker

Java runtime and core types for Microsoft Azure Functions
MIT License
90 stars 57 forks source link

grpc java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: CANCELLED: Client sendMessage() failed with Error #339

Open amamounelsayed opened 4 years ago

amamounelsayed commented 4 years ago

The worker randomly restart using the blobInput httptrigger and bloboutput. The httptrigger uses header not body.

amamounelsayed commented 4 years ago

The issue that grp-java is overwhelmed by the number of the requests which cause the crash. Still investigating if the cause from host or from the java.

@FunctionName("HttpTrigger-Java") public HttpResponseMessage run( @HttpTrigger(name = "req", methods = {HttpMethod.GET, HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional> request, final ExecutionContext context) throws Exception{ context.getLogger().info("Java HTTP trigger processed a request. 1");

 //   get("https://httpstat.us/200");

    // Parse query parameter
    String query = request.getQueryParameters().get("name");
    String name = request.getBody().orElse(query);

    for(int i=0; i<1000000; i++) {
        context.getLogger().fine("Java HTTP trigger processed a request");
    }

    context.getLogger().info("Java HTTP trigger processed a request. 2");

    if (name == null) {
        return request.createResponseBuilder(HttpStatus.BAD_REQUEST).body("Please pass a name on the query string or in the request body").build();
    } else {
        return request.createResponseBuilder(HttpStatus.OK).body("Hello, " + name).build();
    }
}
meeraeldhose commented 3 years ago

Any updates on this. I am also facing this error when running azure functions

parineetha888 commented 3 years ago

Any updates

amamounelsayed commented 3 years ago

Thank you for your message, we implemented new feature for better logging, instead of using the context logging. https://github.com/Azure/azure-functions-java-worker/wiki/Distributed-Tracing-for-Java-Azure-Functions https://docs.microsoft.com/en-us/azure/azure-monitor/app/monitor-functions