-
Notifications
You must be signed in to change notification settings - Fork 66
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
[BUG] Memory leak #341
Comments
I'm experiencing a very similar problem with .NET 6 dockerized apps: My stack:
The problem: At random points, my containers begin to consume an excessive amount of memory, even during periods of inactivity. The memory consumption steadily increases without limit. I've observed the following error is logged when this problem begins:
As a workaround that decrease the impact (in my context) but doesn't solve the underlying issue, I've set this environment variable to disable the GC Server mode:
And applied memory limits to my containers. As a side note, it's very frustrating that the sink lacks documentation on how to use Serilog.Settings.Configuration to apply all the settings from the appsettings files. I've figured out how to set some properties, but not how to configure BootstrapMethod, ConfigureChannel, and DataStream. |
Thank you for reporting this to us and apologies for getting to it late. This memory leak should now be fixed as of: #371 All the documents are owned by the array pools backing While we were disposing the buffers already we localised their lifetimes more tightly so GC can release them faster: elastic/elastic-ingest-dotnet#52 The callbacks no longer get passed an instance of the buffer either just a copy of its metadata: elastic/elastic-ingest-dotnet#53 Both of these greatly ease the memory pressure. Some more background into how the buffer sizes play into memory usages: |
ECS integration/library project(s) (e.g. Elastic.CommonSchema.Serilog):
ECS schema version (e.g. 1.4.0): 8.6.1
ECS .NET assembly version (e.g. 1.4.2): 8.6.1
Elasticsearch version (if applicable): 8.6.2
.NET framework / OS: Core 7 / Any OS
During a soak test on an AKS cluster, during which we enabled verbose logging, our services reached staggering sizes of memory. I took a dmp with dotnet-dump and it turns out there are huge numbers of EcsDocument objects that remain in the generation 2 pool, even after they had been sent to elasticsearch (I verified several of the document instances actually existed in elasticsearch).
Steps to reproduce:
As far as I can say, simply logging a big amount of log lines reproduces this behavior. I created a sample program to demonstrate this:
Here is the output of 'dotnet-dump analyze' of one of the instances:
The text was updated successfully, but these errors were encountered: