U4-7076 - Content publish issue - invalid/corrupt xml cache after publish for the descendant nodes

Created by Martin Fenton 08 Sep 2015, 15:11:33 Updated by Stephan 09 Sep 2015, 09:48:32

Relates to: U4-3787

When a user attempts to publish an unpublished node with descendants using the context menu > publish > include subpages option the descendants appear to be in a corrupt state in the xml cache. Users see a message "Oops: this document is published but is not in the cache (internal error)" on the properties tab.

It seems that when the descendant nodes are retrieved they are not retrieved and processed in the correct top down order across the descendants.

Applies to our installation of Umbraco on version 7.2.8 but I have also replicated it on a clean install of Umraco 7.3.0-RC. The issue is straight forward to replicate using a generic Page -> Component Group -> Component node hierarchy. Simply create the document types and a single content page with descendant nodes across the hierarchy. Then unpublish the page, and republish the page using context menu. Go to properties of any of the descendant nodes and note the message "Oops: this document is published but is not in the cache (internal error)".

The issue appears to be related to U4-3787. One key difference between that old issue and this new issue is the use of the context menu rather then Save and Publish.

The following is my suggested solution and this has been tested and works in our installation of 7.2.8. In CacheRefresherEventHandler.UpdateMultipleContentCache Change DistributedCache.Instance.RefreshPageCache(content.ToArray()); to DistributedCache.Instance.RefreshPageCache(content.OrderBy(x => x.Level).ThenBy(y => y.SortOrder).ToArray());

This ensures that the xml cache refresh is triggered for all descendants in a top down manner. I think that the fix needs to be applied here rather then say ContentRepository.PerformGetByQuery (I checked out applying Level/Sort here as per U4-3787 solution) or ContentService.PublishWithChildrenDo to perform the cache refresh.

Is this the correct appropriate fix? I am happy to work through and contribute this fix

Thanks

Comments

Sebastiaan Janssen 08 Sep 2015, 15:22:51

@zpqrtbnk Can you verify that this is a problem and that the fix is correct please?


Stephan 08 Sep 2015, 15:32:15

Looking into it.


Stephan 08 Sep 2015, 16:25:49

Reproduced.


Stephan 08 Sep 2015, 16:41:09

I ''think'' that the content service should somehow raise events in the proper order, to begin with. In PublishedWithChildrenDo, the descendants of content should come in proper (xml document) order. But they don't. And anyways, PublishedWithChildrenDo will first report content that are already published, and then those that are being published, thus screwing the order. So... in my mind the proper way to fix is by having PublishWithChildrenDo ensure that events are properly ordered.

Pushed b7eb6303ec3417e69d3cbaac64c4722dc3fbc8cd. Works by my tests.


Martin Fenton 09 Sep 2015, 08:38:25

@zpqrtbnk that fix works great! I rolled back my suggested fix and applied this in our installation instead and it works perfectly for my tests as well. Appreciate your help on this. So the fix will be included in the release of 7.3.0? Thanks


Stephan 09 Sep 2015, 09:48:32

Yes it will!


Priority: Normal

Type: Bug

State: Fixed

Assignee: Stephan

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.3.0

Sprint:

Story Points:

Cycle: