-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider implementing AnonymousPipeServer/ClientStream on Unix on socketpair #44329
Comments
If the We could try make |
Good point. We could allow APCS to support both; you just wouldn't get the benefits in the case where it was pipe.
Would that have any negative throughput implications for Socket?
I don't want multiple instances of the SocketAsyncEngine in play, so we would need to expose it in some way for the other assembly to use. This gets back then to how do we push that infrastructure lower for any assembly to use. If you have ideas for what that looks like, I'd love to hear them. We've talked at a high-level about building this support into ThreadPool, and having some kind of API on ThreadPool that sits on top of this. If you have the time and inclination, that could be really interesting to experiment with and come up with a proposal for. Our async I/O support on unix outside of Socket today is lacking. |
With #44647 AnonymousPipeServer/ClientStream use |
Yup. |
Currently AnonymousPipeServerStream and AnonymousPipeClientStream on Unix are implemented on top of
pipe
. This makes sense, but it also makes it difficult for us with our current infrastructure to properly implement async I/O for these streams. This means that Read/WriteAsync on these types are actually async-over-sync and also that cancellation only ends up doing an up-front check and doesn't actually support canceling an operation in progress.NamedPipeServerStream and NamedPipeClientStream on Unix are instead implemented on top of unix domain sockets via System.Net.Socket, and that implementation makes it possible to just rely on the built-in async and cancellation support Socket provides. We could do the same thing with anonymous pipes, using
socketpair
instead ofpipe
to create the underlying file descriptors, and then wrapping those withSocket
just as we do in the named pipes.@tmds, thoughts on this? There would likely be some subtle differences in behavior, especially around buffering. I'm wondering as well if it might be visible in a bad way for anyone extracting the file descriptor from the SafeHandle and using it in some way that
pipe
-generated file descriptors would work butsocketpair
-generated file descriptors wouldn't.The text was updated successfully, but these errors were encountered: