Closed franckyj closed 6 years ago
Thanks for raising the issue. You are right SimpleMessageStore will increase memory usage. We will provide a fix soon.
@franckyj we released a hotfix version V11.12.4.1. In which we remove cache of request/reply. Please try and let's know the result.
Perfect
I'll let you know when we do the update.
Thanks for the quick answer + fix.
We just deployed one of our windows services that deals with Bing Ads using the new V12 API. We instantly saw a massive jump in memory usage (the memory consumption doubled at the minimum). One of our services went as high as using 12GB of memory (according to the task manager).
So we took a process dump and trying to analyze that thing the best I can I find that there is a huge amount of strings (778490298 bytes). Looking at those strings I see serialized Bing Ads requests. Looking at what has its hand on that string I see a
Microsoft.BingAds.Internal.MessagePair
object that is part of a list ofMicrosoft.BingAds.Internal.MessagePair
s which is stored in aMicrosoft.BingAds.Internal.SimpleMessageStore
class.So now clone the Bing Ads repo to see where that message store comes into play. The
SimpleMessageStore
class is used in theMicrosoft.BingAds.Internal.SimpleMessageTracer
class which accesses astatic Store
property. So going up the chain (SimpleTraceBehavior
,ServiceClientFactory
,ServiceClient
=> of which all our custom proxy class inherits) I see that theSimpleTraceBehavior
is added in theServiceClientFactory.CreateChannelFactory
method. Looking at the recent changes on that method I see that this behavior wasn't there before (commit 34e6183f, update to version 11.12.1).Could it be that the static message store is adding all the
MessagePair
instances in theBeforeSendRequest
method and since the store is a static property, it is never removed from memory?I'm by no mean an expert in debugging memory leaks (was using WinDbg for the second time for this analysis...) so I might have skipped something important.
We're using the 11.12.3 version of the Microsoft.BingAds.SDK package on nuget BTW.
Thanks in advance, Francois