Skip to content

ServerCallHandler: OperationCanceledException/IOException as Log Level "Information" #2466

@lindeberg

Description

@lindeberg

Is your feature request related to a problem? Please describe.

Our logs are spammed with this. Guessing it happens when users of the mobile app that is initiating the requests close the app at a specific timing. They all are logged for the same request:

Level: Error
MessageTemplate: Call failed with gRPC error status. Status code: '{StatusCode}', Message: '{StatusMessage}'.
SourceContext: Grpc.Net.Client.Internal.GrpcCall
Exception: System.OperationCanceledException: The operation was canceled.

and

Level: Error
MessageTemplate: Error reading message.
SourceContext: Grpc.AspNetCore.Server.ServerCallHandler
Exception: System.IO.IOException: The client reset the request stream.
   at Grpc.AspNetCore.Server.Internal.PipeExtensions.ReadSingleMessageAsync[T](PipeReader input, HttpContextServerCallContext serverCallContext, Func`2 deserializer)

and

Level: Error
MessageTemplate: Error when executing service method '{ServiceMethod}'.
SourceContext: Grpc.AspNetCore.Server.ServerCallHandler
Exception: System.IO.IOException: The client reset the request stream.
   at Grpc.AspNetCore.Server.Internal.PipeExtensions.ReadSingleMessageAsync[T](PipeReader input, HttpContextServerCallContext serverCallContext, Func`2 deserializer)
   at Grpc.AspNetCore.Server.Internal.CallHandlers.UnaryServerCallHandler`3.HandleCallAsyncCore(HttpContext httpContext, HttpContextServerCallContext serverCallContext)
   at Grpc.AspNetCore.Server.Internal.CallHandlers.ServerCallHandlerBase`3.<HandleCallAsync>g__AwaitHandleCall|8_0(HttpContextServerCallContext serverCallContext, Method`2 method, Task handleCall)

Describe the solution you'd like

IMO: These should not be logged with log level error, but rather with Information.

https://github.com/grpc/grpc-dotnet/blob/master/src/Grpc.AspNetCore.Server/Internal/HttpContextServerCallContext.cs#L196

Describe alternatives you've considered

  • Not logging it at all?
  • Letting package users decide on log level for this specific case

Additional context

Add any other context about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions