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  |  

Maximum ASP
  Ads  
Webhost4Life - $4.95 Windows Hosting
 


  Sponsors  

Meet Our Sponsors

Salaro -- Skins and more
OnyakTech
CrystalTech Web Hosting™
Webhost4life, specialists in DNN hosting
Mad Development is a full service interactive agency focusing on the merge of design, technology, e-commerce, and affiliate marketing by providing total website solutions.
SteadyRain
 


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
1409 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.

 


OnyakTech
Modules for Help Desks, Live Chat, Project Management, CRM, Charting, Reporting, Scrolling Text/Images, Portal Community tools and much more.
www.OnyakTech.com
IHostASP.NET Provides the Ideal DNN Hosting
We will help you with the installation, configuration, and troubleshooting of your DNN portal, no task is too big or small for us. Unlike other companies we are not just providing a reliable hosting service, but we are also focused on providing the best DotNetNuke hosting service on the internet.
www.ihostasp.net
$7.16/mo - Powerful DotNetNuke / DNN Hosting
Powerful DotNetNuke / DNN Hosting on Windows 2008 and 2003 servers, starting at under $8/mo with FREE SQL 2008 on certain plans and FREE SQL 2005 on all plans with FREE Installation and expert support.
www.re-invent.com

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