U4-7101 - ContinouslyUpdateXmlDiskCache = false totally disables XmlCacheFilePersister, so umbraco.config is never written to

Created by Brandon R Barnett 14 Sep 2015, 19:28:02 Updated by Shannon Deminick 20 Apr 2017, 23:10:03

Version: 7.2.8 Production environment issue Issue: umbraco.config never updates

We are creating a scalable app that imports > 100 nodes per day into our content tree. Because we are using an automated process to do so, we set ContinouslyUpdateXmlDiskCache to false because otherwise we see file lock issues (and it's also unnecessary to update the umbraco.config on literally every publish). This has increased the performance of the site and CMS by quite a bit.

My understanding of ContinouslyUpdateXmlDiskCache is that it does not update the umbraco.config file on every publish, but eventually does come back around to it. I'm finding that this is not true, however -- Umbraco reads from it just fine, but it never subsequently saves back to the file. When my next app pool recycle hits, the site reads from the old/stale umbraco.config, and my content will be immediately out of date until I republish using https://[domain]/umbraco/dialogs/republish.aspx

I believe the root cause is in the umbraco.content class, where the SyncToXmlFile boolean isn't doing exactly what it says it's doing (see its accessor on line 707 of https://github.com/umbraco/Umbraco-CMS/blob/db0cfad6b9b216728f040fa237ce69a20205303e/src/Umbraco.Web/umbraco.presentation/content.cs). Basically, if you set the XmlFileEnabled setting to true and ContinouslyUpdateXmlDiskCache to false, we never get past line 44 of the umbraco.content class and therefore the XmlCacheFilePersister never registers, therefore the umbraco.config file is never updated.

I think that's what's going on, but I can't be sure. That's about as much as I can figure out based on my searching through source code today.

Comments

Brandon R Barnett 27 Sep 2015, 14:26:01

Bump. Anything else I can provide to help? This is an active production issue for my client.


Brandon R Barnett 15 Nov 2015, 22:32:54

Is this seriously not going to get resolved? No update since September? Come on, guys...


Dan Malcolm 22 Mar 2017, 09:49:00

Documentation around ContinouslyUpdateXmlDiskCache seems to be misleading.

TLDR: If you change ContinouslyUpdateXmlDiskCache setting to "False", delete the App_Data/umbraco.config file

Some background first:

Umbraco maintains an XML structure in memory for it's published content cache. As content changes are made, this in-memory XML structure is updated. With the default configuration, it also serialises this XML to the App_Data/umbraco.config file on disk, keeping the file up-to-date as content changes.

The purpose of the umbraco.config file is to speed up application startup. If the umbraco.config file is found at startup, then the in-memory published content cache is updated from the file. If the file is not found, then it updates its cache from the XML stored in the cmsContentXml table in the database.

It is important to realise that the published content cache can manage perfectly well without the umbraco.config file. When the application restarts, it populates the cache from the database table - not as quick as deserializing an XML file, but quick enough in practice. The in-memory cache is then kept up to date and there's no danger of things going out of sync.

Back to your question:

The documentation at https://our.umbraco.org/documentation/reference/config/umbracosettings/ suggests the following:

"Updates the XmlCache whenever content is published. If it's set to false, then writes to the disk cache will be queued and performed asynchronously."

That isn't the behaviour that I've observed. Setting the ContinouslyUpdateXmlDiskCache setting to "False" means that the umbraco.config file is never updated.

One possible source of confusion is that if you change the setting to "False" on a site that already has an umbraco.config file in place, then the published content cache will continue to initialise itself from the file. As this is no longer being kept up to date, the cache ends up with stale content. If you change ContinouslyUpdateXmlDiskCache setting to "False", you need to delete the App_Data/umbraco.config file.

So, assuming the above is correct, the "fix" to your issue would be to update the umbracoSettings.config documentation page to more accurately describe what the ContinouslyUpdateXmlDiskCache setting does.


Pete Duncanson 18 Apr 2017, 12:31:26

Submitted a pull request for this https://github.com/umbraco/UmbracoDocs/pull/446


Priority: Normal

Type: Bug

State: Closed

Assignee:

Difficulty: Normal

Category: Architecture

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.2.8

Due in version:

Sprint:

Story Points:

Cycle: