Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dipun 2 posts 22 karma points
    Aug 01, 2014 @ 18:11
    Dipun
    0

    Intermittent issue with Umbraco 6.1.6

    Hey guys,

    We have been trying to resolve a problem which happens quite often on our UAT and Production environment and causes our site to go down.

    We think it may be related to activity within the CMS but we are unable to pin point the issue. I want to dump all of our findings here and I hope that someone will be able to help identify the issue.

    We have a problem when calling: Umbraco.Web.PublishedCache.ContextualPublishedCache<T>.GetById It will throw a null reference exception. This makes our whole site just break since we use this method for every page. Once this problem has happened once, it persists until we recycle the app pool.

    Here is the exception stack trace:

    System.NullReferenceException: Object reference not set to an instance of an object.     at Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedContentCache.<get_GetXmlDelegate>b__2(UmbracoContext context, Boolean preview)     at Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedContentCache.GetById(UmbracoContext umbracoContext, Boolean preview, Int32 nodeId)     at Umbraco.Web.PublishedCache.ContextualPublishedCache`1.GetById(Boolean preview, Int32 contentId)     at COMPANY.Umbraco.ContentStructure.ThemeEngine.ThemeEngineFilterAttribute.OnActionExecuting(ActionExecutingContext filterContext)
    

    We decided to add extra logging around this call to see if we could work out the cause:

    Umbraco in preview mode: false
    content.Instance is null: false
    content.Instance.XmlContent is null: false
    

    Once the issue occurs once, it happens in all browsers in everyones machine (so its not related to cookies or anything like that).

    We looked at the code that the stack trace is talking about and since preview mode is false, it basically boils down to: return content.Instance.XmlContent

    I cannot for the life of me work out where this null reference exception is being called from!

    I hope somebody can help out.

    Thanks,

    Dipun.

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Aug 07, 2014 @ 14:13
    Bo Damgaard Mortensen
    0

    Hi Dipun,

    I'm just curious here really. Where exactly in your code does this happen? Is it when you make a query for a given node?

    If so, what happens if you make a query like this:

    var helper = new UmbracoHelper(UmbracoContext.Current);
    var node = helper.TypedContent(1234); // Where 1234 is the node id
    

    Same error?

  • Dipun 2 posts 22 karma points
    Aug 08, 2014 @ 09:47
    Dipun
    0

    Regarding where the logic is, we have a custom hijacking controller that is set as the default controller for all Umbraco pages. This controller has a custom action filter attached and as seen in the call stack, the error is inside the OnActionExecuting method (just before the MVC action is executed).

    The logic in this method tries to collect some extra data from the CMS which is not in the current page and stores the data in the request context for the templates to consume. The first thing that this method does, is to get an instance of the current node. It does this by calling GetById on the ContentCache using the UmbracoContext:

    var pageId = UmbracoContext.Current.PageId;
    UmbracoContext.Current.ContentCache.GetById(pageId);
    

    What it tries to do after this is irrelevant because the exception is thrown at this point.

    The exception occurs within the GetById method.

    RE: the code snippet, thanks for the snippet, I will have to put this in and see if I can get any more information from it. However, I will not be able to do so until next week, also, the problem only happens once we get into the UAT environment and even then, it is intermittent. All I can do is put in the code and wait.

    Thanks for the idea, I hope to get back to you soon, and I hope the context I described above is enough to spark some more ideas.

    Thanks,

    Dipun

Please Sign in or register to post replies

Write your reply to:

Draft