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

Handles are not disposed #30

Open
papadeu opened this issue Jun 12, 2023 · 1 comment
Open

Handles are not disposed #30

papadeu opened this issue Jun 12, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@papadeu
Copy link

papadeu commented Jun 12, 2023

Describe the bug

Not destroyed handles after a new connection is once used (writeasynch) and disposed. It leads to OutOfMemoryException after many iterations in the same process.

Steps to reproduce the bug

  1. Create a new pipe client:
    _client = new PipeClient(uri, ".", null);
    _client.ConnectAsync().Wait(30);
    _client.ExceptionOccurred += Client_ExceptionOccurred;
    _client.MessageReceived += Client_MessageReceived;

  2. Write sometihng to server process:
    _client.WriteAsync(messageObject).Wait();

  3. Dispose client after all done:
    _client.ExceptionOccurred -= Client_ExceptionOccurred;
    _client.MessageReceived -= Client_MessageReceived;
    _client.DisconnectAsync().Wait();
    _client.DisposeAsync();
    _client = null;

  4. Iterate 1000 times -> there are about 1000 more handles in the process. Note: if you omit step 2 - everything works clean.

Expected behavior

No additional handles after 1000 iterations within the same client process

Screenshots

No response

NuGet package version

1.14.8

Platform

Console

IDE

Visual Studio 2022, Visual Studio 2019

Additional context

No response

@papadeu papadeu added the bug Something isn't working label Jun 12, 2023
@tkontro
Copy link

tkontro commented Oct 19, 2023

I think that I managed to fix this at the server side:
pipeServer.ClientDisconnected += async (sender, args) => await args.Connection.DisposeAsync();

At least pipelist.exe shows that extra pipes are cleaned away.

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