Copied to clipboard

Flag this post as spam?

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

  • Steve Smith 75 posts 158 karma points
    Mar 27, 2013 @ 12:29
    Steve Smith

    Bizarre Razor macro caching problem

    Hi all,

    We have a large multisite Umbraco (4.7.1) CMS setup, and to improve performance, we cache some of the macros.

    One in particular is a Razor macro that outputs a "site search" box.  Doesn't actually need to be cached really, but this is just an example (we've had a similar issue with other macros).

    In the back office developer tab, I have it setup to "cache by page" and to refresh after 3600 seconds (1 hour).

    When I look at the debug trace of a page on the site, I can see that the "signature" for the cached macro includes the current page Node Id (and a parameter we pass), so it definitely seems to be doing that correctly:

    Rendering started (macro: SearchBox, type: 6, cacheRate: 3600)
    Macro Control loaded from cache 'SearchBox-27516-true-'

    (node Id of page being visited in this case is 27516).

    However, sometimes (and without explanation) the search box setup for site B ends up being rendered on site A (so when the user performs a search on Site A, the form Url is to the search page on Site B).  

    In theory this should be impossible, because the page node Ids for site B are in a separate branch of the node tree to site A, and are obviously also all unique.  But in practice it is happening - not reproducably though. Since most of the time, it works fine, I don't think its a bug in the macro script itself, but more a problem with the caching system becoming corrupted somehow.

    Just wondered if anyone has come across this problem before?




  • Steve Smith 75 posts 158 karma points
    Mar 27, 2013 @ 13:08
    Steve Smith

    Replying to add... I note that we are running Umbraco and that the Umbraco 4.7.2 release notes mention these work items:

    • 27610 Razor macros not appearing on page
    • 30786 Severe Issue with macro caching under heavy load
    These seem to be connected with our problem (especially the latter) - although I can't find out the details behind the problem work item 30786 related to, and what was done to fix it.
    I assume updating to 4.7.2 is relatively painless, and might be worthwhile?  Moving to an even later version is probably better, but I'm looking for a way to fix the issue quickly without much downtime :-) 
Please Sign in or register to post replies

Write your reply to: