akkadotnet / akka.net

Canonical actor model implementation for .NET with local + distributed actors in C# and F#.
http://getakka.net
Other
4.73k stars 1.04k forks source link

Memory leak, event messages not disposing #2282

Closed schepersk closed 8 years ago

schepersk commented 8 years ago

We have an issue because of non disposing event messages. Our setup is a CQRS/ES architecture, powered by Cluster Sharding and SQL Server persistence.

For some obscure reason, there is this one event type that is not disposing. Instances have been persisted in the event journal and all read model projections have been executed (AR actor/shard entity publishes them on the Akka EventStream, projection actors subscribe to them).

Other event message types are not being held in memory!

Akka version 1.1.1, SQL Server persistence 1.1.1.5-beta, Cluster sharding 1.1.1.28-beta

Here is a screen shot of the memory dump being debugged in VS: image

Aaronontheweb commented 8 years ago

@Horusiath hmmm... think it could be the MessageExtractor perhaps?

Horusiath commented 8 years ago

MessageExtractor is pretty dumb - it's only resolving values from provided message fields. It doesn't block and doesn't stack anything.

After some chat on gitter it looks like some problem with specific implementation - probably publishing persisted events on the event bus. This hardly looked as problem inside Akka.NET - from the memory dump we can say that LbvIngeschreven is an custom persisted event and it's placed directly inside akka.net Envelope. This suggest problem in the user code - nowhere in akka internals persisted events are send directly between two actors, they are always wrapped with other internal message wrapper.

Horusiath commented 8 years ago

Closing this one. The problem is not related to Akka.NET itself.