Skip to content

Exception HTTP/2 error code 'PROTOCOL_ERROR' (0x1) #278

Closed
@rupreck

Description

@rupreck

The following exception occurs when this package is used in a .NET 7 service with Kestrel where another connection type is also used.

01:56:10 ERR] An unhandled exception has occurred while executing the request.
Grpc.Core.RpcException: Status(StatusCode="Internal", Detail="Error starting gRPC call. HttpRequestException: An error occurred while sending the request. HttpProtocolException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1).", DebugException="System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.Net.Http.HttpProtocolException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1).
   at System.Net.Http.Http2Connection.ThrowRequestAborted(Exception innerException)
   at System.Net.Http.Http2Connection.Http2Stream.CheckResponseBodyState()
   at System.Net.Http.Http2Connection.Http2Stream.TryEnsureHeaders()
   at System.Net.Http.Http2Connection.Http2Stream.ReadResponseHeadersAsync(CancellationToken cancellationToken)
   at System.Net.Http.Http2Connection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.Http2Connection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at Grpc.Net.Client.Balancer.Internal.BalancerHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Grpc.Net.Client.Internal.GrpcCall`2.RunCall(HttpRequestMessage request, Nullable`1 timeout)")
   at async Task<TResponse> ProtoBuf.Grpc.Internal.Reshape.UnaryTaskAsyncImpl<TRequest, TResponse>(AsyncUnaryCall<TResponse> call, MetadataContext metadata, CancellationToken cancellationToken) i**n /_/src/protobuf-net.Grpc/Internal/Reshape.cs:line 549**
   at Organisation SA.Common.Client.Orchestrator.Request.OrganisationRequest.GetOrganisationByName(string organisationName) in C:/repos/sqa/common/SA.Common.Client.Orchestrator/Request/OrganisationRequest.cs:line 131
..
..

This occurs in Reshape.cs:line 549 when opening a Azure Hybrid Relay Connection any time before or after the GRPC connection is established.

The connection hangs and then throws the above exception. It may be that the HTTP2 connection is downgraded in the background to http1.1 when the connection is established with the listener on the other end of the Azure Relay.

The problem is not resolved by specifying Http2 or restricting Kestrel to only listen to LocalHost or by correctly using https with a certificate.

Perhaps this is due to this Kestrel problem discussed here..
dotnet/aspnetcore#44537
dotnet/aspnetcore#44657

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions