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

Akka.Remote memory leak fix: use singleton allocators for DotNetty channels. #3436

Merged

Conversation

Aaronontheweb
Copy link
Member

close #3430

So this was a bug I introduced in #3395

When manually configuring the allocator for use inside the DotNettyTransport, I was new-ing up an allocator each time. Instead going forward we'll use the singleton default built into DotNetty.

I'm not 100% sure this eliminates any possibility of buffers leaking on all platforms, since it seems like there's some major runtime differences that could affect this on .NET Core vs. .NET and on Linux / Windows, but this is definitely one possible source of the problem.

.Option(ChannelOption.SoReuseaddr, Settings.TcpReuseAddr)
.Option(ChannelOption.SoKeepalive, Settings.TcpKeepAlive)
.Option(ChannelOption.TcpNodelay, Settings.TcpNoDelay)
.Option(ChannelOption.AutoRead, false)
.Option(ChannelOption.SoBacklog, Settings.Backlog)
.Option(ChannelOption.Allocator, Settings.EnableBufferPooling ? (IByteBufferAllocator)new PooledByteBufferAllocator() : new UnpooledByteBufferAllocator())
.Option(ChannelOption.Allocator, Settings.EnableBufferPooling ? (IByteBufferAllocator)PooledByteBufferAllocator.Default : UnpooledByteBufferAllocator.Default)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would definitely solve the allocator issue for clients... but the server is where we detected this memory leak and IIRC, this ServerBootstrap gets re-used to recreate client connections over and over again. Thus, I'm not sure this would actually impact the server. Bleh.

@Aaronontheweb
Copy link
Member Author

Got approval from @Horusiath in Gitter, so I think we're good to go here. Can get this in the next nightly for users experiencing #3430

@Aaronontheweb Aaronontheweb merged commit 843ecc2 into akkadotnet:dev May 7, 2018
@Aaronontheweb Aaronontheweb deleted the fix-3430-dotnetty-allocator branch May 7, 2018 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase Server Memory When Client program repeats ActorSelection and Terminated
1 participant