0

I have ran into a problem where a long running singleton added to HttpApplicationState which does some data masking (GDPR), stops masking data after running in the background for some time.

It's hard to debug because it only happens in our UAT enviroment and it usually happens overnight.

The problem is that the data masking library is third party, and is still work in progress (or at the end of that work in progress).

But I'd appreciate if anyone with better GC knowledge could look at the init code below, and confirm this is out of GC domain.

The Translator.GetInstance() is a Lazy loader of the GDPR masking/translation singleton. So it's initialized the first time the user masks/unmasks the data.

protected void Application_Start()
{
    if (Translator)
    {
       Application["MaskDataUtility"] = new MaskDataUtility(Translator.GetInstance());
    }
    else
    {
       Application["MaskDataUtility"] = new MaskDataUtility(new CustomTranslator());
    }
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
steakoverflow
  • 1,206
  • 2
  • 15
  • 24
  • 1
    Hi, what is your question exactly? Do you want to know when this object is collected? As it is now, it seems it's only freed when your application is shutting down. – Stefan Sep 03 '18 at 14:43
  • 1
    If it’s long running shouldn’t you use a Windows Service.. Apparently the experts are sparse in the are of software garbage collection.. There is also GC.KeepAlive or check out the documentation below https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/fundamentals – boateng Sep 04 '18 at 04:37

0 Answers0