Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...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.

Vicenç Masanas
Banyoles, Girona - Spain

Disgrafic.com    PSD to DNN
 
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 DNN Platf...Using DNN Platf...Administration ...Administration ...DataCache.GetCache usage causing exceptionsDataCache.GetCache usage causing exceptions


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, 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 DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out