HomeHomeUsing DotNetNuk...Using DotNetNuk...Administration ...Administration ...DataCache.GetCache usage causing exceptionsDataCache.GetCache usage causing exceptions
Previous
 
Next
New Post
1/17/2006 2:13 AM
 

I've noticed in quite a few places that the root cause for exceptions is the pattern I see DataCache.GetCache() used.

The patten that I see is:

If (DataCache.GetCache("object") Is Nothing)
   Dim obj = code for loading config from files
   
DataCache.SetCache("object", obj)
End If
Return DataCache.GetCache("object")

The problem I'm seeing is there is a time window between the SetCache and the final return that can result in the cache being thrown out, especially when multithreaded operations are happening.

Wouldn't the following pattern make more sense?

Dim obj = DataCache.GetCache("object")
If obj Is Nothing
   obj = code for loading config from files
   
DataCache.SetCache("object", obj)
End If
Return obj

 

 
New Post
1/22/2006 3:14 AM
 

Maybe no one cares...  but I went through my entire project and here are the files that had what appears to be a potential timing issue bug (search for DataCache.GetCache).  The interesting thing is out of 27 files, only these 8 followed this pattern.  The rest followed the pattern I suggested.

Domain.vb
Configuration.vb
XMLLoggingProvider.vb
RewriterConfiguration.vb
ClientAPI.vb
UserOnlineController.vb
Localization.vb
SiteLogController.vb

After putting the changes on my site, the number of exceptions I ran into significantly diminished.

 
New Post
1/23/2006 11:47 AM
 
James,
I'm very interesed in this changes and wanted to know if this change continues to look as the root of these exceptions.
Please if you're monitoring your system and let us know if this was the root problem.

Disgrafic.com
 
New Post
1/24/2006 10:27 AM
 

Without digging deeper into how the Cache expires, I can't say for sure this is the root issue.  That said, coding practices do say that you shouldn't return something you haven't verified to be null if the callers are not expecting null.  I also suspect the call would be faster allocating on object on the heap and assigning it once, rather then making another stack call to the cache function, though I'd have to verify that through ILSAM.

On my server, the random null reference exceptions I was getting for various functions all went away after making these changes.  The only exception I'm getting now is intermitent Thread Abort exceptions on the scheduler threads and a couple exceptions for the Forum module that I'd still trying to track down.

If you want details of the changes I made, I can either post or send a diff.

James

 
New Post
1/24/2006 11:12 AM
 

Hey james,

Could you send me a diff?  It sounds like it would clear up a lot off errors I'm seeing on my sites.  I get referals from google andmsn search that reference pages that have moves or no longer exist and the search engines aren't picking up on the 301's I send back but DNN generates the cache error you discribe.


Paul Davis
 
Previous
 
Next
HomeHomeUsing DotNetNuk...Using DotNetNuk...Administration ...Administration ...DataCache.GetCache usage causing exceptionsDataCache.GetCache usage causing exceptions


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

Attend A Webinar
Start  Professional Edition Trial
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

Sponsors

DotNetNuke Corporation

DotNetNuke (DNN) provides a suite of solutions that make designing, building and managing feature-rich sites and communities fast, easy and cost-effective. The DotNetNuke Platform CMS is the foundation for more than one million websites worldwide. DNN Social, our newest solution, enables businesses to create immersive, interactive communities. Thousands of organizations like True Value Hardware, Bose, Cornell University, Glacier Water, Dannon, Delphi, USAA, NASCAR, Northern Health and the City of Denver have leveraged DNN to deploy highly engaging business- critical websites. Our rapid growth in product sales and deployments resulted in DotNetNuke Corp. being named one of the fastest growing private companies in America by Inc. Magazine in 2011 and 2012.