Skip to content
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

Returned by server pipeName is null #20

Open
juergstaub opened this issue Apr 28, 2022 · 2 comments
Open

Returned by server pipeName is null #20

juergstaub opened this issue Apr 28, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@juergstaub
Copy link

Describe the bug

We are sporadically seeing the following exception when connecting > 1 pipeclient with pipeClient.ConnectAsync()

System.InvalidOperationException: Connection failed: Returned by server pipeName is null at H.Pipes.PipeClient1.GetConnectionPipeName(CancellationToken cancellationToken)
at H.Pipes.PipeClient1.GetConnectionPipeName(CancellationToken cancellationToken) at H.Pipes.PipeClient1.ConnectAsync(CancellationToken cancellationToken)`

Clients are connected in a relatively short time, the problem is already visible with 3 clients, but does not happen all the time.

Steps to reproduce the bug

Create pipe server
Create multiple pipe clients

Expected behavior

All pipe clients connect normally and without ab exception

Screenshots

No response

NuGet package version

Platform

Console

IDE

Other

Additional context

No response

@juergstaub juergstaub added the bug Something isn't working label Apr 28, 2022
@juergstaub
Copy link
Author

juergstaub commented Apr 28, 2022

I able to mitigate the problem by adding a random delay before ConnectAsync:

var r = new Random();
 await Task.Delay(r.Next(2000, 5000));
await pipeClient.ConnectAsync();

@HavenDV
Copy link
Owner

HavenDV commented Apr 29, 2022

Thanks for the problem and detailed description. Yes, indeed, the main pipe of the server accepts requests one at a time, and there may be problems with simultaneous requests from several clients.

Comments for correction (to me in the future or anyone who wants to do this):

  • We need to create a test to test this by trying to connect as many clients at the same time as is guaranteed to throw an exception.

I'll get into this after checking out this PR - #19 because it changes the code a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants