PowerPlatform-DataverseServiceClient icon indicating copy to clipboard operation
PowerPlatform-DataverseServiceClient copied to clipboard

High memory consumption after exceptions being thrown

Open tovyhnal opened this issue 1 year ago • 1 comments

As suggested in here, we started using ServiceClient as singleton in our application. Recently we noticed, that our web application started occasionally failing with OutOfMemoryException.

We believe, this is connected with our migration to singleton ServiceClient.

I was able to repro this (high memory usage) locally, by requesting non-existing entity from DV, which resulted in exception being thrown in ServiceClient. After 10k of such iterations, memory grew to 1,4GB.

Image

I suspect, it is connected to DataverseTraceLogger and this code which add any thrown exception into internal list of exceptions. This can accumulate over days to size, which causes service to crash with OutOfMemoryException.

See below state of DataverseTraceLogger after ~400 exceptions thrown. Image

tovyhnal avatar Oct 16 '24 20:10 tovyhnal

I ran memory profiler, which I believe confirms my assumption:

Image

tovyhnal avatar Oct 17 '24 16:10 tovyhnal

Fix was provided by reporter internally thanks @tovyhnal , Fix will be provided in the next update drop to the client.

MattB-msft avatar Oct 24 '24 16:10 MattB-msft

@MattB-msft Is there an estimate when this will be included in a new release?

ChrisIsidora avatar Oct 30 '24 11:10 ChrisIsidora

Fix was provided in the associated release

MattB-msft avatar Nov 06 '24 20:11 MattB-msft