Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected http3 request while using the grpc-web #2476

Open
shuowpro opened this issue Jul 2, 2024 · 1 comment
Open

Unexpected http3 request while using the grpc-web #2476

shuowpro opened this issue Jul 2, 2024 · 1 comment
Labels
question Further information is requested

Comments

@shuowpro
Copy link

shuowpro commented Jul 2, 2024

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?

@shuowpro shuowpro added the question Further information is requested label Jul 2, 2024
@fallenwood
Copy link

I met the same problem today, but I cannot reproduce it with local environment :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants