Skip to content

Handles are not disposed #30

@papadeu

Description

@papadeu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions