MassTransit / Sample-Grpc

5 stars 1 forks source link

Catching GRPC exceptions #2

Closed gabrieldelaparra closed 2 weeks ago

gabrieldelaparra commented 2 weeks ago

Hi hi,

I am having some issues trying to catch the following exceptions:

[INF] [MassTransit] gRPC Connect: http://127.0.0.1:50476/ [WRN] [MassTransit] gRPC Connection Faulted: http://127.0.0.1:50476/ Grpc.Core.RpcException: Status(StatusCode="Unavailable", Detail="Error connecting to subchannel.", DebugException="System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it.") ---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it. at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|2850(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) at Grpc.Net.Client.Balancer.Internal.SocketConnectivitySubchannelTransport.TryConnectAsync(ConnectContext context) --- End of inner exception stack trace --- at Grpc.Net.Client.Internal.HttpContentClientStreamWriter2.WriteCoreAsync(TRequest message, CancellationToken cancellationToken) at MassTransit.GrpcTransport.GrpcClient.SendJoin(IAsyncStreamWriter1 requestStream) in //src/Transports/MassTransit.GrpcTransport/GrpcTransport/GrpcClient.cs:line 124 at MassTransit.GrpcTransport.GrpcClient.RunAsync() in /_/src/Transports/MassTransit.GrpcTransport/GrpcTransport/GrpcClient.cs:line 55

I have tried the following:

services.AddMassTransit(x => {
    x.SetKebabCaseEndpointNameFormatter();

    x.AddConfigureEndpointsCallback((context, name, cfg) =>
    {
        //Tried to Ignore them here
        cfg.UseMessageRetry(r => r.Ignore(typeof(System.Net.Sockets.SocketException), typeof(Grpc.Core.RpcException)));
    });

    x.UsingGrpc((context, cfg) => {
        cfg.Host(h => {
            h.Host = "0.0.0.0";
            h.Port = 50477;
            h.AddServer(new Uri("http://127.0.0.1:50476"));
        });
        //Tried to Ignore them here
        cfg.UseMessageRetry(r => r.Ignore(typeof(System.Net.Sockets.SocketException), typeof(Grpc.Core.RpcException)));

        cfg.ConfigureEndpoints(context);
    });
});

Could you please provide a hint of where can I catch these?

I tried adding both to Visual Studio to try to debug where they might be coming from, but I could not make the debugger stop with these.

gabrieldelaparra commented 2 weeks ago

Missed to add: I am using version 8.1.3 both for MassTransit and MassTransit.grpc: 8.2.5 for MassTransit will not work with 8.1.3 GRPC.

phatboyg commented 2 weeks ago

MassTransit is no longer supporting gRPC.

gabrieldelaparra commented 2 weeks ago

Any suggestions on how to approach IPC?

phatboyg commented 2 weeks ago

Between processes? No, sorry.