Skip to content

Unexpected http3 request while using the grpc-web #2476

Closed
@shuowpro

Description

@shuowpro

We are using the grpc web on net framework because we have some problem about supporting the http2. we are expecting that while using the grpc-web, it should using the http1.1, however, we get the following exception which indicates that it try to using the http3 instead. that is something we didn't expected.

The exception:

{"Grpc.Core.RpcException":"Grpc.Core.RpcException: Status(StatusCode="Unavailable", Detail="Error starting gRPC call. HttpRequestException: The connection timed out from inactivity. (example.com:443) QuicException: The connection timed out from inactivity.", DebugException="System.Net.Http.HttpRequestException: The connection timed out from inactivity. (example.com:443)")\r\n ---> System.Net.Http.HttpRequestException: The connection timed out from inactivity. (example.com:443)\r\n ---> System.Net.Quic.QuicException: The connection timed out from inactivity.\r\n at System.Net.Quic.QuicConnection.HandleEventShutdownInitiatedByTransport(_SHUTDOWN_INITIATED_BY_TRANSPORT_e__Struct& data)\r\n at System.Net.Quic.QuicConnection.HandleConnectionEvent(QUIC_CONNECTION_EVENT& connectionEvent)\r\n at System.Net.Quic.QuicConnection.NativeCallback(QUIC_HANDLE* connection, Void* context, QUIC_CONNECTION_EVENT* connectionEvent)\r\n--- End of stack trace from previous location ---\r\n at System.Net.Quic.ValueTaskSource.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)\r\n at System.Net.Quic.QuicConnection.FinishConnectAsync(QuicClientConnectionOptions options, CancellationToken cancellationToken)\r\n at System.Net.Quic.QuicConnection.g__StartConnectAsync|2_0(QuicClientConnectionOptions options, CancellationToken cancellationToken)\r\n at System.Net.Quic.QuicConnection.g__StartConnectAsync|2_0(QuicClientConnectionOptions options, CancellationToken cancellationToken)\r\n at System.Net.Http.ConnectHelper.ConnectQuicAsync(HttpRequestMessage request, DnsEndPoint endPoint, TimeSpan idleTimeout, SslClientAuthenticationOptions clientAuthenticationOptions, CancellationToken cancellationToken)\r\n --- End of inner exception stack trace ---\r\n at System.Net.Http.ConnectHelper.ConnectQuicAsync(HttpRequestMessage request, DnsEndPoint endPoint, TimeSpan idleTimeout, SslClientAuthenticationOptions clientAuthenticationOptions, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpConnectionPool.GetHttp3ConnectionAsync(HttpRequestMessage request, HttpAuthority authority, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpConnectionPool.TrySendUsingHttp3Async(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)\r\n at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)\r\n at Grpc.Net.Client.Web.GrpcWebHandler.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)\r\n at Grpc.Net.Client.Internal.GrpcCall2.RunCall(HttpRequestMessage request, Nullable1 timeout)\r\n --- End of inner exception stack trace ---\r\n at Grpc.Net.Client.Internal.GrpcCall`2.GetResponseHeadersCoreAsync()\r\n at Microsoft.Exchange.Hygiene.ContentExtraction.Core.ContentExtractionGrpcNetCoreClient.RetrieveContentExtractionRemoteResponseAsync(IContentExtractionLogger contentExtractionLogger, ContentExtractionRemoteRequestPayload requestPayload, Guid tenantId)"}

The code we are using:

            // the subdirectoryhandler is from https://learn.microsoft.com/en-us/aspnet/core/grpc/troubleshoot?view=aspnetcore-8.0#calling-grpc-services-hosted-in-a-sub-directory
            var handler = new GrpcWebHandler(
                new SubdirectoryHandler(
                    new HttpClientHandler(), "/app"));
            handler.HttpVersion = System.Net.HttpVersion.Version11;

            HttpClient httpClient = new HttpClient(handler);
            GrpcChannelOptions channelOptions = new GrpcChannelOptions()
            {
                HttpClient = httpClient,
                ServiceConfig = new ServiceConfig(),
            };
            var channel = GrpcChannel.ForAddress("https://example.com/", channelOptions);
            return channel;

Anyidea why it happened, how could we enforce it to using http1.1 instead of http3?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions