Umb 8.2 - Publish with Descendants errors
See original GitHub issueif you have an unpublished node and you attempt to publish the parent node with the Publish with Descendants option, you get an error. (most of the time, not always!)
Reproduction
Bug summary
Publishing a parent node with ‘Publish with descendants’ can cause an error:
Server error: Contact administrator, see log for full details.
No more children.
Steps to reproduce
This can be reproduced on a blank install with the starter kit, but it doesn’t always display the error (so might take two or three goes).
-
NuGet install of Umbraco 8.2.0 ,
-
installed via the ‘install’ (so with the starter kit)
-
Unpublish the
Todo list for this starter kit
page -
Attempt to publish with Descendants the ‘About us page’
This may work, fine, try steps 3 & 4 Again a few times and it will break.
- Once broken republishing the
Todo List
page and trying to publish descendants fromAbout Us
will still produce the result
via code, publishing a number of child nodes (but not all of them) and then attempting to publish the parent or another unpublished child node can also produce similar results - but this is a lot harder to reproduce for an issue
Expected result
The page should publish with no errors.
Actual result
The screenshot above and The logged error is :
Exception
Umbraco.Core.Exceptions.PanicException: No more children.
at Umbraco.Web.PublishedCache.NuCache.ContentStore.AddTreeNodeLocked(ContentNode content, LinkedNode`1 parentLink) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\ContentStore.cs:line 1035
at Umbraco.Web.PublishedCache.NuCache.ContentStore.SetBranch(Int32 rootContentId, IEnumerable`1 kits) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\ContentStore.cs:line 746
at Umbraco.Web.PublishedCache.NuCache.PublishedSnapshotService.NotifyLocked(IEnumerable`1 payloads, Boolean& draftChanged, Boolean& publishedChanged) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\PublishedSnapshotService.cs:line 663
at Umbraco.Web.PublishedCache.NuCache.PublishedSnapshotService.Notify(JsonPayload[] payloads, Boolean& draftChanged, Boolean& publishedChanged) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\PublishedSnapshotService.cs:line 602
I have also seen, but i am struggling to get a new installation to reproduce this one.
Umbraco.Core.Exceptions.PanicException: failed to get last child with id=-1
at Umbraco.Web.PublishedCache.NuCache.ContentStore.GetRequiredLinkedNode(Int32 id, String description, Nullable`1 gen) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\ContentStore.cs:line 828
at Umbraco.Web.PublishedCache.NuCache.ContentStore.AddTreeNodeLocked(ContentNode content, LinkedNode`1 parentLink) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\ContentStore.cs:line 986
at Umbraco.Web.PublishedCache.NuCache.ContentStore.SetBranch(Int32 rootContentId, IEnumerable`1 kits) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\ContentStore.cs:line 746
at Umbraco.Web.PublishedCache.NuCache.PublishedSnapshotService.NotifyLocked(IEnumerable`1 payloads, Boolean& draftChanged, Boolean& publishedChanged) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\PublishedSnapshotService.cs:line 663
This item has been added to our backlog AB#3239
Issue Analytics
- State:
- Created 4 years ago
- Comments:21 (15 by maintainers)
For people who need a quick fix before we can do a proper release of 8.2.1: attached is an 8.2.0 dll, with just this fix applied on top of it, you only need to replace this one dll and it should be fixed for you:
Umbraco.Web.dll.zip
I think these are reliable steps to reproduce both errors. For “No more children”:
For “failed to get last child”:
It does seem to be related to resetting the sibling IDs in
RemoveTreeNodeLocked
. When the node is saved and published after unpublishing, the version with the sibling IDs set to -1 is found as the existing version, and its sibling IDs are copied to the new generation.With the sibling IDs broken, when publishing with descendants we either fail to find the right place in the sort order as in #6419, or we copy the -1 from PreviousSiblingContentId to the parent’s LastChildContentId in
RemoveTreeNodeLocked
.