gRPC stopped working with APO on Windows 11

460 Views Asked by At

I have a Windows application (APP) and Audio Processing Object (APO) loaded by AudioDG.exe that communicate via gRPC:

  1. APP part that is written in C# creates server via Grpc.Core.
  2. APO part creates client via grpc++.
  3. Server is on 127.0.0.1:20000 (I can see it's up and listening with netstat -ano).
  4. I can confirm that APO is loaded into audio device graph by inspecting it with process explorer.

Everything worked like a charm on Windows 8 and 10, but on 11 it cannot communicate at all - I get either Error Code 14, Unavailable, failed to connect to all addresses or 4, Deadline Exceeded.

After enabling debug traces, I now see "socket is null" description for "connect failed" error: I0207 16:20:59.916447 0 ..\..\..\src\core\ext\filters\client_channel\subchannel.cc:950: subchannel 000001D8B9B01E20 {address=ipv4:127.0.0.1:10000, args=grpc.client_channel_factory=0x1d8bb660460, grpc.default_authority=127.0.0.1:10000, grpc.internal.subchannel_pool=0x1d8b8c291b0, grpc.primary_user_agent=grpc-csharp/2.43.0 (.NET Framework 4.8.4470.0; CLR 4.0.30319.42000; net45; x64), grpc.resource_quota=0x1d8b8c28d90, grpc.server_uri=dns:///127.0.0.1:10000}: connect failed: {"created":"@1644240059.916000000","description":"socket is null","file":"..\..\..\src\core\lib\iomgr\tcp_client_windows.cc","file_line":112}

What I've tried so far:

  1. Updating both parts to the latest grpc versions.
  2. Using "no proxy", "Http2UnencryptedSupport" and other env variables.
  3. Using "localhost" or "0.0.0.0" instead of "127.0.0.1".
  4. Updating connection to use self signed SSL certificates (root CA, server cert + key, client cert + key).
  5. Adding inbound / outbound rules for my port, and then disabling firewall completely.
  6. Creating server on APO side and trying to connect with the client in APP.

Everything works (both insecure and SSL creds) if I create both client and server in C# part, but as soon as it's APP-APO communication it feels blocked or sandboxed.

What has been changed in Windows 11 that can "block" gRPC?

Thanks in advance!

1

There are 1 best solutions below

2
On

In your input you write:
Server is at 127.0.0.1:20000

Further looking at the logs, you can see that:
The server is located at grpc.server_uri=dns:///127.0.0.1:10000

Based on the question posed and the amount of data provided, I would check which port the server is really using and which port the client is looking for a connection on.

The easiest way to do this is to use the built-in Resource Monitor application. On the Network tab, in the TCP Connections list, you can find the application and the port it uses.

You can also use the PowerShell command

Test-NetConnection -Port 10000 -InformationLevel "Detailed"
Test-NetConnection -Port 20000 -InformationLevel "Detailed"

At least this is the first thing I would check based on what you described.

Regarding your question about the changes in Windows 11, I do not think that this is something that's causing problems for you. However, Windows 11 has additional security features compared to Windows 10, try disabling the security features completely as a test. Perhaps this will help solve the problem.

As for ASP.NET Core 6.0 itself (if I understood the version correctly), then there is a possibility that the server part, working not in the sandbox of the programming environment, still does not accept the client certificate. At the program level, you can try to fix this by adding the following exception to the code:

// This switch must be set before creating the GrpcChannel/HttpClient.
AppContext.SetSwitch(
    "System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);

// The port number(5000) must match the port of the gRPC server.
var channel = GrpcChannel.ForAddress("http://localhost:5000");
var client = new Greet.GreeterClient(channel);

More troubleshooting issues with ASP.NET Core 6.0 Microsoft described in detail here. https://learn.microsoft.com/en-us/aspnet/core/grpc/troubleshoot?view=aspnetcore-6.0

I hope it was useful and at least one of the solutions I suggested will help solve your problem. In any case, if I had more information, I think I could help you more accurately.