Skip to content
This repository was archived by the owner on Jun 1, 2024. It is now read-only.

Serilog. Sinks. Elasticsearch memory leaks to large memory and not GC #368

Open
2 tasks done
liuyl1992 opened this issue Oct 26, 2020 · 4 comments
Open
2 tasks done

Comments

@liuyl1992
Copy link

liuyl1992 commented Oct 26, 2020

Serilog. Sinks. Elasticsearch memory leaks to large memory and not GC

Does this issue relate to a new feature or an existing bug?

  • Bug

What version of Serilog.Sinks.Elasticsearch is affected? Please list the related NuGet package.
8.1.0

What is the target framework and operating system? See target frameworks & net standard matrix.

  • netCore 3.1

Please describe the current behavior?
When the log sector is "information", the memory is large and not recycled

Please describe the expected behavior?
Normal recovery memory

@orjan
Copy link
Contributor

orjan commented Oct 26, 2020

@liuyl1992 do you have a sample that reproduces the issue that you can share?

@Mpdreamz
Copy link
Contributor

What version of Elasticsearch.Net did it resolve to? 8.1.0 by default installs 7.0.0 because nuget resolves to lowest.

In older version of Elasticsearch.Net relied on recyclablememorystream by default which allocates and reuses byte arrays. This was often being reported as a memoryleak as the buffers grew.

We switched the default back to using a new memory stream everytime with
elastic/elasticsearch-net#4202

Later versions of the sink rely on Elasticsearch.Net 7.8.1 which should exhibit this new behavior.

@Mpdreamz
Copy link
Contributor

Mpdreamz commented Nov 2, 2020

Actually on 7.x the default has not changed yet

You can call .MemoryStreamFactory(Elasticsearch.Net.MemoryStreamFactory.Default) to change away from RecyclableMemoryStreamManager

I think this is a saner default that will come with less surprises.

@stevejgordon
Copy link

Just an FYI on this issue. The next release 7.14 will include this change which flips the default behaviour as @Mpdreamz suggested above.

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

No branches or pull requests

4 participants