Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

AspDotNetStoreFront
  Ads  
r2i.ntegrated
 


  Sponsors  

Meet Our Sponsors

Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
Salaro -- Skins and more
OnyakTech
CrystalTech Web Hosting™
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Configure It! (...  DataCache.GetCache usage causing exceptions
Previous Previous
 
Next Next
New Post 1/16/2006 11:13 PM
User is offline James Webster
63 posts
www.mhs87.com
10th Ranked


DataCache.GetCache usage causing exceptions 

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 12:14 AM
User is offline James Webster
63 posts
www.mhs87.com
10th Ranked


Re: DataCache.GetCache usage causing exceptions 

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 8:47 AM
User is offline Vicenç Masanas
1421 posts
www.disgrafic.com
6th Ranked








Re: DataCache.GetCache usage causing exceptions 
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 7:27 AM
User is offline James Webster
63 posts
www.mhs87.com
10th Ranked


Re: DataCache.GetCache usage causing exceptions 

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 8:12 AM
User is offline Paul Davis
615 posts
www.phdavis.com
7th Ranked


Re: DataCache.GetCache usage causing exceptions 

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 Previous
 
Next Next
  Forum  General DotNetN...  Configure It! (...  DataCache.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.

 


Lucede Systems Group
Providing a full range of IT services for large and medium sized companies
www.lucede.com
Adaptive InfoSystems, Inc.
We provide custom programming and various levels of support for DotNetNuke and the .Net framework.
www.aisysweb.com
Multipartner Virtual Data Rooms
The Virtual Data Rooms (VDR) provided by an expert advisor, far from any ordinary software company!, supporting the sellers and their consultants. Multipartner builds and services higly professional Virtual Data Rooms (VDR) specifically tailored to M&A, Real Estate and NPL deals.
www.multipartner.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP