grpc-dotnet-namedpipes icon indicating copy to clipboard operation
grpc-dotnet-namedpipes copied to clipboard

May need a timeout on client read (appears to be infinite?)

Open rmacfadyen opened this issue 4 years ago • 2 comments

Trying this out and I put together some very bad code that was hard to figure out why things were going wrong.

The main symptom was that a client would wait perpetually for a response after successfully sending a message. The server would never receive a message. No errors, no exceptions. I didn't wait very long, a few minutes.

The underlying cause was bad code binding the server:

var server = new NamedPipeServer("MyPipeName");
MyService.BindService(new MyServiceService());

It should have been:

var server = new NamedPipeServer("MyPipeName");
MyService.BindService(server.ServiceBinder, new MyServiceService());

Everything worked "fine" except this never returns:

var channel = new NamedPipeChannel(".", "Test");
var ServiceClient = new MyService.MyServiceClient(channel);
var response = await ServiceClient.SendMessageAsync(new SomeMessaget() { Name = "bugger" });

No errors or exceptions I could find.

rmacfadyen avatar Dec 19 '20 20:12 rmacfadyen

I can consider changing the defaults, but there is a client timeout option: https://github.com/cyanfish/grpc-dotnet-namedpipes/blob/043cead5ba3d0e3fb746160dc7e71729a66d657c/GrpcDotNetNamedPipes/NamedPipeChannelOptions.cs#L40

cyanfish avatar Dec 20 '20 02:12 cyanfish

Thanks!

I think that a default of a few seconds would be more helpful. Maybe even 30 seconds at the outside?

rmacfadyen avatar Dec 20 '20 04:12 rmacfadyen

I added a 30s default timeout in 2.0.0.

cyanfish avatar Nov 11 '22 02:11 cyanfish