Closed nzdvis closed 2 years ago
@nzdvis thanks for contacting us.
You are measuring with a profiler and very likely in debug mode, which invalidates your measures.
You can check https://github.com/sebastienros/memoryleak for details on how to measure and detect memory leaks.
@nzdvis thanks for contacting us.
You are measuring with a profiler and very likely in debug mode, which invalidates your measures.
You can check https://github.com/sebastienros/memoryleak for details on how to measure and detect memory leaks.
Hello @javiercn,
Yes, I looked at that afterwards.
But I'm also measuring in production from the docker image I use in Kubernetes, where the memory usage also is constantly climbing. That's the most important part (The two blue screenshots).
@nzdvis we keep a number of circuits (up to a max) in a disconnected state for about 3 minutes (this is the default but it is configurable) before they get "released". Even after they get released, the memory won't be claimed until the next GC happens. Even after the next GC happens, you might not see the memory decrease (depending on how you are measuring) if the GC doesn't return the memory to the OS.
Also, an important side note is that .NET 5.0 is out of support and we would recommend in any case to move to 6.0 as the first step
@javiercn and how is this configurable?
As I wrote, I have tried:
o.DisconnectedCircuitRetentionPeriod = TimeSpan.FromSeconds(0);
- Not workingBut I'll look into moving to 6.0 soon.
Thanks for your help so far.
@nzdvis it takes some time from when a user navigates away until we detect that the circuit was disconnected. Mostly because normally the browser abruptly terminates the connection and it takes SignalR some time to pick that up.
@javiercn my bad, I just forgot how browsers work :D
Thanks, closing "issue" now :)
@nzdvis no worries. This is a confusing area for many people and we are looking to see how we can bring more visibility to it in the future.
Is there an existing issue for this?
Describe the bug
We host our Blazor site in AKS (Azure Kubernetes Service), and I got notified that the site was climbing fast in memory usage. I thought that something was wrong with some of my components, but no memory leak what so ever was wrong with them, or some of the third-party components we use.
The site is designed to be integrated in slideshows (They browse the URL and get some graphs displayed). We currently have one customer testing the solution.
So they visit our page once every minut.
I then tried to simulate the scenario (Just by hitting F5 every 15 seconds): Diagnostics session:![image](https://user-images.githubusercontent.com/82027269/172808560-4b0b6af2-e94b-4a12-a98e-3762ca344d5a.png)
Azure newly uploadet memory usage:![image](https://user-images.githubusercontent.com/82027269/172809664-dfaae22e-fe3a-49a0-993b-07a5a8d33c5c.png)
Azure after 5 min memory usage:![image](https://user-images.githubusercontent.com/82027269/172809766-17101fc4-e73d-4ca5-b29d-419c21c6244d.png)
I then tried with a cleanly new Blazor Server-Side project, and the same thing happend (Not the same memory amount was used, but it was still climbing).
Then I thought it could be circuit build-up, so I tried to remove and change retention period:
o.DisconnectedCircuitRetentionPeriod = TimeSpan.FromSeconds(0);
- Not workingThe only thing that seemed to work in diagnostics tool and in logging
GC.GetTotalMemory(false)
, was to runGC.Collect()
orGC.GetTotalMemory(true)
. But it did nothing in Kubernetes.Why is the memory just climbing, and how do I stop the server from retaining circuits?
Thanks for any help in advance :)
Expected Behavior
No response
Steps To Reproduce
Exceptions (if any)
No response
.NET Version
5.0.405
Anything else?
.NET SDK (reflecting any global.json): Version: 5.0.405 Commit: 63325e1c7d
Runtime Environment: OS Name: Windows OS Version: 10.0.19043 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.405\
Host (useful for support): Version: 5.0.14 Commit: d5b56c6327
.NET SDKs installed: 5.0.203 [C:\Program Files\dotnet\sdk] 5.0.400 [C:\Program Files\dotnet\sdk] 5.0.405 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]