Search code examples
asp.net.netasp.net-core.net-core

Asp.Net Core 7 memory leak on not used app?


I have a very simple Asp.Net Core 7 (7.0.9 default image from microsoft) that NOBODY is using. Really: I start the pod on my AKS and no one makes a single request to it and it doesn't consume any queues or topics or whatever. It's just there...

And yet, every minute, AKS reports that the memory usage of this app is a little higher. At the end of an hour or two the graph looks like this (value in bytes): enter image description here

Now, of course, I cannot reproduce this issue on my local machine... but some differences already point out. First, in my local machine, the app starts at around 60MB... if I open swagger and use a tool like fiddler to overload it with requests, its memory footprint goes as high as 150... but in production, it starts at 175MB...

So, my first thought was, lets get a dump at the very begging and one when the memory is quite high, using the baseline, VS will show me where all that memory went... but it didn't help at all... the post-restart dump is 450MB, and the when the memory was at around 300 is 500MB, but comparing both gave me nothing extra...

Looking solely at the later dump, I cannot "reconcile" the info from AKS that says that the app is using 350MB... the biggest object reported is smaller than 1MB and the 11th is smaller than 100kb... the sum is 53k objects amounting to 4MB!!!

how can I find where the leak is?


Solution

  • Turns out this is a internal bug and its fixed with this PR: https://github.com/dotnet/runtime/pull/96561