Closed dave-yotta closed 3 years ago
Does the fallback http handler not support http 2.0 or something?
Yes, it doesn't support unencrypted HTTP/2.
I'll try to remove it, but this was turned on to be compatible with some 3rd party API which had some compatibility issues.
The AppContext.SetSwitch
will disable the SocketsHttpHandler
globally. Do you know why the 3rd party library requires this global modification? It might help to see if an update of the library would resolve the issue or understand what the underlying compat issue is.
Ok thanks, the 3rd party is the mongodb atlas webapi, there's a .NET runtime ticket to fix up the digest authentication here: https://github.com/dotnet/runtime/issues/50283. I've instead grabbed some manual digest auth code from SO (it's not pretty) for until we get to .NET5/6.
It's not a GRPC bug, and not sure there's a lot you can do here other than improving the message if that's even possible.
I don't know of any way to improve the error message thrown by gRPC. It is reporting what HttpClient says.
What version of gRPC and what language are you using?
c# .net core 3.1
Client (MagicOnion.Client 4.1.2)
Server (MagicOnion.Server 4.1.2)
What operating system (Linux, Windows,...) and version?
mcr.microsoft.com/dotnet/aspnet:3.1-buster-slim
What runtime / compiler are you using (e.g. .NET Core SDK version
dotnet --info
)mcr.microsoft.com/dotnet/sdk:3.1
What did you do?
App running in development env after nightly getting some of these errors - not observed during (fairly extensive) testing. Have added in both client and server:
And additionally on the server told kestrel:
What did you expect to see?
No Errors :)
What did you see instead?
(raised on client)
Anything else we should know about your project / environment?
I have a feeling this might be happening when the server is terminated with sigkill by oomkiller or just a straight OOMException that doesn't allow completion of the request - having a dig through observability stuff now to see. Not sure if there's much that can be done in that case but I thought I might as well ask!
Update: That doesn't appear to be the case, at least not OOM. We're running on AWS EB, which is different to our test environemts (EKS) - and have seen it doing some weird things with ulimits and such. Is there anything on the OS/Docker Host level that could prevent Http2 from working? The RPC is IPC between processes running on the same container.
Update 2: Doesn't seem to be environment specific either. It's working with one client (a console app) but raising this error with a different client (a kestrel webapi app).
Update 3: Not sure if related, but debugging on windows I actually am getting:
I'm getting this on the client, this is probabbly the cause of both issues, the server doesn't like the request preface and is closing the connection? Still digging....
Possibly important: the server is a process started with
Process.Start
from the clientUpdate 4: It seems that the HttpClient used here is not compatible with http2 when the Grpc client makes calls from within the ASP,NET Core 3.1 WebApi project - server is saying "Invalid Http/2 connection preface". When doing the same thing from a .NET Core 3.1 Console project - communication takes place without issue.
There are different environment vars being inherited each time - the ASP project starts the server via Proces.Start with the extra vars: "ASPNETCORE_ENVIRONMENT, ASPNETCORE_HTTPS_PORT, ASPNETCORE_URLS, COMPLUS_NoGuiFromShim". However unsettling those in the process start info makes no difference.
I've sett the HttpMessageHandler to set request.Version = "2.0" on all requesets when creating the GrpcChannelOptions Setting HttpHandler. This isn't forcing the communication to 2.0 either.
Update 5: Looks like someone had set
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
in the client application which is getting this errorI'll try to remove it, but this was turned on to be compatible with some 3rd party API which had some compatibility issues. Does the fallback http handler not support http 2.0 or something?