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

Curious about not working on Linux

Open lsylusiyao opened this issue 4 years ago • 3 comments

I've tried a very simple example which could easily run on Windows, but on Linux, client couldn't connect to server. I've checked the source code on git and it seems that there's no Interop about Windows API. I know this is targeting Windows but I'm very curious about why this package doesn't work well on Linux. Is there any suggestions about making it work on Linux? Thanks.

lsylusiyao avatar Mar 10 '21 12:03 lsylusiyao

It might be related to this? https://stackoverflow.com/questions/46683772/issue-with-net-core-named-pipes-on-linux-address-already-in-use

cyanfish avatar Apr 06 '21 22:04 cyanfish

I've checked the source code of System.IO.Pipes. It seems that the problem you've mentioned above has fixed so it shouldn't be the reason of not working on Linux.

Though the absolute name of the name pipes are different between Windows and Unix, the server and client use the same name on one platform, so it shouldn't be the problem of name's difference.

What's more, through the source code I've found that dotnet created a name pipe called /tmp/CoreFx_SOMENAME, but when I ls inside /tmp, the only thing I've got about dotnet is a list of clr-debug-pipe-*** and dotnet-diagnostic-***. I'm confused about this. Thanks.

PS: I've tested this on WSL2, Win10 20H2

lsylusiyao avatar Apr 07 '21 02:04 lsylusiyao

I find out that the true problem of not working on *nix is that, when creating the NamedPipeServerStream, PipeTransmissionMode.Message is used which is not supported on *nix (ServerStreamPool.cs). Maybe one of the reason using the Message is it's a quick way of receiving data from pipe. I don't really understand how gRPC deals with message, but I find a way from a similar project which adds some bytes in front of the stream to indicate the whole transforming bytes. This might be a way of making this project work on *nix.

lsylusiyao avatar Jun 30 '21 09:06 lsylusiyao

Linux (and Mac) support should now work in 2.0.0.

cyanfish avatar Nov 11 '22 02:11 cyanfish