U4-7333 - New domain service cache issue

Created by Patrick Scott 30 Oct 2015, 20:22:13 Updated by Patrick Scott 11 Jan 2016, 09:37:14

Duplicates: U4-7558

This is with 7.3.0

I have a site with around 50 hostnames defined on a root node. Three times in the last week, the in memory cache of hostnames gets corrupted and only around 10 are linked to that node (the rest are missing). A restart of the app pool re-loads the hostnames from the db and it works fine again. There is nothing unusual in the logs.

I have looked into the core code and I think this is to do with the way the caching of the umbracoDomain table is done. In pre 7.3 there was one cache item "UmbracoDomainList" and in 7.3 there is one cache item per domain e.g. "umbrtmche-uRepo_IDomain_RowID" - it is caching at the repository level now.

I am assuming if a cache item is expired/removed then this is not reloaded from the database then umbraco routing assumes it does not exist. The next time I have this issue I will check to see what items are in the cache and update here.

Comments

Nicholas Westby 31 Oct 2015, 17:32:40

Might be related to this (short version is it only caches up to about 100 domains): https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/72571-fetching-url-on-ipublishedcontent-hits-database


Patrick Scott 31 Oct 2015, 20:10:55

OK, I can confirm that when I have this issue, the related domain names are not in the cache. I have compared the domains shown in the "culture and hostnames" dialog box to the "umbrtmche-uRepo_IDomain_RowID" cache items and the hostnames missing from the dialog box are the ones which have been removed from the cache.


Patrick Scott 31 Oct 2015, 20:22:53

@Knickerbocker This may well be related as I think both have appeared due to the change in the way domains are cached.


Patrick Scott 31 Oct 2015, 21:24:17

Reading through the code, if I understand the repository caching, this is due to the RepositoryCacheOptions.GetAllCacheValidateCount being set to false. This means that if any of the IDomain cache items are expired from the cache then the domains are not reloaded from the database and just the domains left in the cache are returned in the GetAll() function call.


Stephan 17 Nov 2015, 16:28:31

Confirmed - the repository cache needs some love.


Patrick Scott 19 Nov 2015, 10:10:14

@zpqrtbnk Is the caching of domains going to be looked at separately? I thought this would be a critical error as sites can go offline unexpectedly as the code stands now.


Stephan 19 Nov 2015, 10:14:30

Well, this is about the caching of domains too. Only, here it is a cache corruption/refresh issue (IIC) and the other issue is that we stop caching if you have more than 100 domains. You can create a separate issue if you want but I think we need is a global review of that cache code and that would deal with both issues. Making sense?


Patrick Scott 19 Nov 2015, 11:05:17

Yes, that makes sense, I was just hoping for a quick fix - in 7.3.2?


Patrick Scott 11 Jan 2016, 09:36:46

@Kim.Thomsen This issue is being addressed in U4-7558 which should be released in 7.3.5 soon.


Priority: Show-stopper

Type: Bug

State: Duplicate

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.3.0, 7.3.1

Due in version:

Sprint:

Story Points:

Cycle: