Bug reports Found a bug? Post it here please.
Version 4.x > Bug reports > Website crashes after period of inactivity (problem with the social bookmarking control?) View modes: 
User avatar
Member
Member
mark-livingagile - 10/5/2009 1:38:32 AM
   
Website crashes after period of inactivity (problem with the social bookmarking control?)
My company just installed Kentico to test it out, and this error happens on a daily basis, usually in the mornings and it stays crashed until the website is manually restarted. So, until we find a fix, this will prevent us from purchasing a license and using it for our production deployment.

Based on the event log data, it appears that the crash has something to do with the social bookmarking control.

Here is the crash log from the event log:

Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 10/3/2009 11:58:09 PM
Event time (UTC): 10/4/2009 6:58:09 AM
Event ID: 1dc370632e714dda93186e8e11bb99ed
Event sequence: 303
Event occurrence: 145
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/6/ROOT-1-128991119927618912
Trust level: Full
Application Virtual Path: /
Application Path: C:\Webs\livingagile.com\
Machine name: WEBSERVER02

Process information:
Process ID: 7152
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE

Exception information:
Exception type: ArgumentNullException
Exception message: Key cannot be null.
Parameter name: key

Request information:
Request URL: http://*********/CMSPages/PortalTemplate.aspx?aliaspath=/Home
Request path: /CMSPages/PortalTemplate.aspx
User host address: ***********
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Thread information:
Thread ID: 7
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace: at System.Collections.Hashtable.get_Item(Object key)
at CMSWebParts_Community_SocialBookmarking.SetupControl()
at CMS.PortalControls.CMSWebPartZone.OnContentLoaded()
at CMS.PortalControls.CMSAbstractLayout.OnContentLoaded()
at CMS.PortalControls.CMSAbstractLayout.LoadContent(PageInfo pageInfo, Boolean reloadData, Boolean allowOrphanedZones)
at CMS.PortalControls.CMSPagePlaceholder.LoadContent(PageInfo pageInfo, Boolean reloadData)
at CMS.PortalControls.CMSPortalManager.LoadContent(Boolean reloadData)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
=============== System information ==================
CMS version : 4.1 Build : 4.1.3518
OS version : Microsoft Windows NT 6.1.7600.0

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 10/8/2009 3:17:31 AM
   
RE:Website crashes after period of inactivity (problem with the social bookmarking control?)
Hello,

Could you please let us know what the exact symptoms of your issue are? What does "stays crashed" means? Is there any asp.net exception, or any other error message on the page? If so please post here a screenshot.

Moreover, does this appear on regular basis or randomly?

Best Regards
Ondrej Vasil

User avatar
Member
Member
mark-livingagile - 10/8/2009 3:30:04 AM
   
RE:Website crashes after period of inactivity (problem with the social bookmarking control?)
Yes. It is an ASP.NET crash. See the error log I posted for the stack trace.

Once this error occurs, it will continue occurring each page load until the website is restarted in IIS, or the AppDomain recycles. During that time, any attempt to access the site will generate the ASP.NET error page with the same crash details.

We are using portal mode.

User avatar
Member
Member
mark-livingagile - 10/8/2009 3:37:15 AM
   
RE:Website crashes after period of inactivity (problem with the social bookmarking control?)
The crash appears almost every day -- sometimes several times a day. When I get into the office in the morning, the test site that is running Kentico will generate this error, and I restart it in IIS.

It seems to depend on whether anyone has hit the site recently. Like maybe it is expecting something in the HttpRuntime.Cache and it is expiring but the social bookmark control doesn't check for Null?

Based on the stack trace (see my first post in this thread), the crash is generated by looking for a non-existent key in a dictionary. It is probably as simple as rewriting the relevant line(s) of code so that it calls TryLookup(), which won't throw an exception if the key is missing, instead of the implicit, indexer-based lookup which does throw the KeyNotFound exception that I am seeing when the key is missing.

If necessary, I can always bust out Reflector and tell you exactly what the problem is, but I think this should be enough info for your devs -- especially since the stack trace shows exactly which method is causing the crash, and it is not a race condition or anything dicey.

User avatar
Member
Member
mark-livingagile - 10/8/2009 3:40:56 AM
   
RE:Website crashes after period of inactivity (problem with the social bookmarking control?)
Disregard what I said above about the KeyNotFound exception. That is not the exception we are seeing. It is throwing an ArgumentNullException because the SetupControl() method on the social bookmarking webpart is attempting to access a dictionary with a Null key -- which isn't possible.

So, I'm not sure why it would do that, but it may be something to do with caching, as I mentioned before. Please let me know ASAP if there is a hotfix or something that will fix this problem!

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 10/15/2009 8:38:44 AM
   
RE:Website crashes after period of inactivity (problem with the social bookmarking control?)
Hello,

I guess it is a bug. I totally understand your situation. I've forwarded it to our developers and I will let you know what step should be done in order to fix this issue.

Best regards
Ondrej Vasil

User avatar
Member
Member
mark-livingagile - 10/15/2009 4:07:23 PM
   
RE:Website crashes after period of inactivity (problem with the social bookmarking control?)
I did a bit more digging and the error is occuring within the code behind for the CMSWebParts\CommunityServices\SocialBookmarking.ascx web part. I have turned on debugging in the web.config file, so that the next time it crashes, I will be able to see exactly which line number is causing the crash.

However, ever since I've switched debugging on, it has not crashed. Weird.

On a side note, I reviewed the code in the user control, and I did not see any obvious mistakes in the code that would cause the bug. However, the one thing that I do notice is that the data is stored in a static hashtable that will be shared by all threads, and access to that shared resource is not synchronized. This could cause the hashtable to become corrupted during initialization.

To fix this potential problem a lock statement can be added that surrounds the initialization code in the FillHashTable() method (to ensure that two threads don't simulataneously initialize the data):

    private static void FillHashTable()
{
lock (bookmarkServices.SyncRoot)
{
if (bookmarkServices.Count == 0)
{
// Each record has display name, url, url to book and title
bookmarkServices["GoogleBookmarks"] = new string[] { "Google Bookmarks", "http://www.google.com/bookmarks/mark?op=add&bkmk=", "&title=" };
/* .... etc. */
}
}
}

The lack of a lock here may actually be the cause of the crash, since two threads adding things to the hashtable at the same time could cause its state to get corrupted.

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 10/19/2009 10:16:19 AM
   
RE:Website crashes after period of inactivity (problem with the social bookmarking control?)
Hello,

Good point. You are right - It's not thread safe code. It should be fixed now and will be available in the next hotfix.

Best regards
Ondrej Vasil