-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
PipeServer crashing with many connections, IOException: 'Pipe is broken' #22
Comments
I remember having some problems with Debug when I didn't use H.Pipes.AccessControl for the server. Are you using it? In particular |
Yes, I used H.Formatters.MessagePack & H.Pipes.AccessControl in the original program but not in this reproduction example. Now added them in a new branch: https://github.com/erezwanderman/HPipeMultiClient/tree/MessagePack%26AccessControl. |
After analyzing it furthuer, I think that in IO/PipeStreamWriter.cs, PipeStreamWriter.WriteAsync, the call BaseStream.WriteAsync sends the response, and sometimes the client is fast enough to quickly disconnect before the server finishes flushing and draining, and then the server throws exception on flushing or draining. It can be avoided by catching and ignoring in I think this Stack Overflow question and answer addresses this exact problem. Idea for solution: have a closing-handshake. When calling DisconnectAsync or DisposeAsync on PipeClient, do not disconnect but rather send a message to the server to disconnect. And then the server will disconnect. |
I have released a new version with a suggested fix, please check it out. The ideal situation would be if you could write a test that fails in the version of the library before this fix, so that the situation does not happen again and I do not miss anything. |
Thanks! This fixes the issue and now the program works without exceptions. |
Hi, I'm evaluating some c# Named Pipes nugets and while testing this one I encountered this "Pipe is broken" problem, perhaps in a little bit different way but none the less. I started the ConsoleApp sample and used a SysInternals tool called accesschk.exe to check what it reports. Upon doing so I can't catch any exceptions, but the pipe server stops working after a single calling like this
The tool prints a list of permissions set on the pipe and then very quickly disconnects. Perhaps this tool can be used to find out what happens in H.Pipe, and perhaps prevent the pipeserver from stop serving clients. I find it very useful to check that running pipeservers do have the right permissions. Unfortunately meny named pipe implementations fail to handle this tools rather crude behaviour. This nuget seams to be a very nice package, thank you! |
The problem is computer related. |
Just to be sure - are your clients and servers console applications? |
No, .NET 6, WPF |
I will write tests for high-load situations when I have free time. |
The problem is that I have to isolate the Canon EDSDK dll, the only option was to run a separate client for each camera. I'll check later. |
Wanted so to follow a lot of connections.
|
Replace |
Describe the bug
I have a program with a client that sends a message and waits for a response, and a server that waits for clients, and when one sends a message, the server sends a response.
Sometimes the server crashes when it tries to send a response with args.Connection.WriteAsync
Happens when running the server in debug from Visual Studio. Doesn't happen when running the server from console.
Steps to reproduce the bug
Expected behavior
No crash, send message successfully
Screenshots
NuGet package version
2.0.37
Platform
Console
IDE
Visual Studio 2022
Additional context
No response
The text was updated successfully, but these errors were encountered: