Skip to content

TcpOutgoingConnection does not dispose properly - memory leak #3211

@yoPCix

Description

@yoPCix

Experienced on Akka.Net 1.3.2. On Windows 10 64-bit
Steps to recreate:

  1. Open Tcp connections
  2. Close all Tcp connections (stop all Tcp connection actors)
    Even though all actual Sockets are being closed and disposed, some SocketAsyncEventArgs instances are not being disposed. They contain reference to IActorRef so the ActorCell instance is also not getting GC'ed.

I debugged through source code and found out that when opening connection, TcpOutgoingConnection acquires 3 SocketAsyncEventArgs instances from PreallocatedSocketEventAgrsPool, however when connection closes, only 2 instances are getting released.
Also if an InvalidOperationException exception occurs during release, the SocketAsyncEventArgs instance will probably never get neither back to the pool nor get disposed because the connection actor is already stopped.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions