cyanfish / grpc-dotnet-namedpipes

Named pipe transport for gRPC in C#/.NET
Apache License 2.0
190 stars 48 forks source link

Could not talk to containerd service using this implementation of NamedPipeChannel #46

Closed arasheedu closed 1 year ago

arasheedu commented 1 year ago

Hi there,

I am trying to talk to containerd service using this nuget package. And it doesn't quite work, spend some time debugging this but could not come to a conclusion about what's causing this.

Any idea what is going wrong? I am attaching the simplest sample to reproduce the problem. You just need to have containerd service running while bringing up the attached client program.

ContainerDClient.zip

Any insight would be appreciated.

At the highest level it says "Could not connect to all addresses" but I have debugged all the way to into the framework and it appears like WriteFile is hanging.

Thanks!

cyanfish commented 1 year ago

I assume this is on Windows? I'm not familiar with containerd but assuming it's similar to Docker, I'm not sure that named pipes will work out of the box. Looks like there's some support but it might require configuration.

arasheedu commented 1 year ago

Thanks for the reply, yes this is on Windows and both client code and containerd service running on the same machine. CotainerD is docker runtime engine and the containerd service is listening on pipe address "\\.\pipe\containerd-containerd". I am baffled why WriteFile is hanging when your implementation write to it. ContainerD service itself is implmented in GO language. Grpc supposed to be language agnostic I thought? I debugged the containerd service as well and the named pipe connection is getting established.

cyanfish commented 1 year ago

Oh I see, I misunderstood what you were saying. As mentioned in the readme this project is not compatible with Go-based gRPC services.

arasheedu commented 1 year ago

Just curious, what would it take to make it compatible?

cyanfish commented 1 year ago

As I understand it, the Go version works by running a full HTTP client/server over the named pipe, which is not really feasible with this project (and would compromise it being lightweight/low-overhead).

It looks like .NET 8 (in preview) has added gRPC named pipe server support to ASP.NET. And as you're client-only it looks like the client portion would work with just .NET 6/7.

You might be able to get that working - I'm not 100% sure that it's compatible with the Go version but I assume they would have wanted that to work.

cyanfish commented 1 year ago

(And if you do get that to work, please let me know, I'm curious.)

arasheedu commented 1 year ago

I will try and keep you posted. Thanks!

arasheedu commented 1 year ago

Yes!! The client logic works when I followed - "https://learn.microsoft.com/en-us/aspnet/core/grpc/interprocess-namedpipes?view=aspnetcore-8.0#client-configuration" in .NET8 against a custom build of containerd.

cyanfish commented 1 year ago

Cool! Thanks for letting me know. I've updated this project's readme with a comparison matrix to point that out and show the differences.