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

TcpOutgoingConnection does not dispose properly - memory leak #3211

Closed
yoPCix opened this issue Dec 13, 2017 · 3 comments
Closed

TcpOutgoingConnection does not dispose properly - memory leak #3211

yoPCix opened this issue Dec 13, 2017 · 3 comments

Comments

@yoPCix
Copy link
Contributor

yoPCix commented Dec 13, 2017

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.

@Horusiath
Copy link
Contributor

Thanks @yoPCix for pointing that out. I'll try to take a look at this, but given the amount of tasks, I've got on me, this may take a while. If you're willing to help, I'd appreciate that ;)

@yoPCix
Copy link
Contributor Author

yoPCix commented Dec 13, 2017

I already fixed it. I'll create a pull request soon.

yoPCix pushed a commit to scopetech/akka.net that referenced this issue Dec 13, 2017
yoPCix pushed a commit to scopetech/akka.net that referenced this issue Dec 14, 2017
yoPCix pushed a commit to scopetech/akka.net that referenced this issue Dec 14, 2017
Aaronontheweb pushed a commit that referenced this issue Dec 15, 2017
* Fix TcpOutgoingConnection memory leak (#3211)
@Aaronontheweb Aaronontheweb added this to the 1.3.3 milestone Dec 15, 2017
@Aaronontheweb
Copy link
Member

Closed via #3212

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants