Description
Description of bug
I'm sorry if this is not the right place to post this. But I suspect that Dependency Injection implemented in DNN 9.4 is causing memory leaks and if so it might be important for others too.
After upgrading from DNN 8.0.4 to 9.4.1 the memory consumption of my website (the w3wp process) is increasing indefinitely until all server resources is consumed. The site is not slowing down or affected in any way though, i.e. no errors in the admin logs.
The site is not using any 3rd part modules. But only "thin" frontend modules pulling data from custom build web api services (a project with controllers that inherits from DnnApiController).
No source code was changed when upgrading other than changing target .NET Framework version of the project to 4.7.2. No compiler errors and no errors in the DNN log.
I've been "debugging" in production by deactivating the use of different parts of the service, but without luck.
When analyzing a memory dump of the IIS w3wp process (using dotMemory from Jetbrains and DebugDiag from MS) I see the the garbage collector heap usage (generation 2) is quite large with about 2/3 of the total memory usage. Also there are a lot of "objects ready for finalization". (see https://ibb.co/Yt1GVkG )
And at the top of memory usage list is Microsoft.Extensions.DependencyInjection.ServiceProvider (see https://ibb.co/vjK5rsc ).
I've run out of ideas. If this is caused by Dependency Injection, then others might experience the same. Perhaps without knowing it yet. I have a lot of traffic on the site (20-25k user session per day) and the memory consumption hits 2 GB in about 6 hours at which point the app pool recycles.
Is it possible for this to be related to DI, perhaps in combination with using DnnApiController (my code was not changed during upgrade)? Could DI prevent the garbage collector from eliminating dead objects?
If needed I can add source code examples (even though no exceptions are thrown) or more info from the memory profiler.
Thanks a lot.
Steps to reproduce
I have not been able to reproduce this locally. Perhaps a different stress testing tool is needed. Or maybe it's related to the production server environment (Windows Server 2008 R2 + IIS 7.5)
Current result
Ever increasing memory consumption.
Expected result
Memory usage should be stable. It was stable at 600 MB in DNN8 using the same code.
Screenshots
This is screenshots of some of the memory profiler reports:
https://ibb.co/Yt1GVkG
https://ibb.co/vjK5rsc
Error log
No errors in error log.
Affected version
- [?] 10.0.0 alpha build
- 9.4.1
- [?] 9.4.0