question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scheduled publish fails when multiple pages are published - Umbraco 8.6.1

See original GitHub issue

Scheduled publishing can fail when publishing multiple pages at the same time.

Umbraco version

I am seeing this issue on Umbraco version: 8.6.1

Reproduction

If you set multiple pages (in testing approx. 10-20 seems do it) to have the same scheduled publish date, then when that date arrives not all items will be published. and scope errors (below) will be reported in the log.

Specifics

It looks like its an issue with the Scope while running in a background task, but i am at a loss to see what it should be doing 😞

Steps to reproduce

  1. New Umbraco Install - (With standard starter key, SQLCE DB)
  2. Schedule the individual pages in the starter kit to publish at the same time (takes about 5-10 mins to do, so pick a time-date that gives you time to go through the site).
  3. Wait for publish
  4. Look through logs. should see the errors below:

Expected result

All pages should be published.

Actual result

Some pages are published, but the background process stops at some point with an error:

System.AggregateException: Exceptions were thrown by listed actions. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Umbraco.Core.Scoping.Scope.<>c__DisplayClass71_0.<RobustExit>b__2() in D:\a\1\s\src\Umbraco.Core\Scoping\Scope.cs:line 437
   at Umbraco.Core.Scoping.Scope.TryFinally(Int32 index, Action[] actions) in D:\a\1\s\src\Umbraco.Core\Scoping\Scope.cs:line 472
   at Umbraco.Core.Scoping.Scope.TryFinally(Int32 index, Action[] actions) in D:\a\1\s\src\Umbraco.Core\Scoping\Scope.cs:line 476
   at Umbraco.Core.Scoping.Scope.TryFinally(Int32 index, Action[] actions) in D:\a\1\s\src\Umbraco.Core\Scoping\Scope.cs:line 476
   at Umbraco.Core.Scoping.Scope.RobustExit(Boolean completed, Boolean onException) in D:\a\1\s\src\Umbraco.Core\Scoping\Scope.cs:line 420
   at Umbraco.Core.Scoping.Scope.DisposeLastScope() in D:\a\1\s\src\Umbraco.Core\Scoping\Scope.cs:line 400
   at Umbraco.Core.Scoping.Scope.Dispose() in D:\a\1\s\src\Umbraco.Core\Scoping\Scope.cs:line 363
   at Umbraco.Core.Services.Implement.UserService.GetUserById(Int32 id) in D:\a\1\s\src\Umbraco.Core\Services\Implement\UserService.cs:line 714
   at Umbraco.Core.Services.Implement.UserService.GetProfileById(Int32 id) in D:\a\1\s\src\Umbraco.Core\Services\Implement\UserService.cs:line 670
   at Umbraco.Core.ContentExtensions.GetWriterProfile(IContent content, IUserService userService) in D:\a\1\s\src\Umbraco.Core\ContentExtensions.cs:line 262
   at Umbraco.Examine.ContentValueSetBuilder.<GetValueSets>d__3.MoveNext() in D:\a\1\s\src\Umbraco.Examine\ContentValueSetBuilder.cs:line 43
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at System.Linq.GroupedEnumerable`3.GetEnumerator()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
   at Umbraco.Examine.UmbracoContentIndex.PerformIndexItems(IEnumerable`1 values, Action`1 onComplete) in D:\a\1\s\src\Umbraco.Examine\UmbracoContentIndex.cs:line 87
   at Examine.Providers.BaseIndexProvider.IndexItems(IEnumerable`1 values) in C:\projects\examine-qvx04\src\Examine\Providers\BaseIndexProvider.cs:line 76

N.B for the above this error goes through the UserService - but I have also seen it in the PublicAccess service - I think DisposeLastScope is the issue?

before this error - there will usually be two scope warnings…

Missed "ScopeContext" Object "4c4688a1"

e.g

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Shazwazzacommented, Apr 28, 2020

Yep! that is exactly why this is happening. It’s the exact same issue. Any background task that is performing any DB interaction with the services must use an explicit Scope, else an ambient CallContext scope will be used which will have problems if there is multi-threading going on in that CallContext.

In this case its while examine is indexing things and it calls into the ValueSetBuilder. In cases where the user’s cache is expired it will make a DB query to get the user but in certain situations this will cause problems because the value set builder wasn’t using an explicit Scope. This is fixed in https://github.com/umbraco/Umbraco-CMS/pull/7994 along with a small perf enhancement.

0reactions
kuwukuscommented, Nov 30, 2021

Hello I’m also facing this issue when content is published and replicated to front end instances. Can it be resolved if we rebuild examine indexes?

Read more comments on GitHub >

github_iconTop Results From Across the Web

scheduled publish issue - Using Umbraco And Getting ...
From the looks of this, you can't publish two pages at the same time if they are parent and child. As the parent...
Read more >
Scheduled Publish not working
Umbraco version: 8.10.1 .Net Version: 4.8. Error: error image. System.ArgumentException: Culture "" is not explicit. bei Umbraco ...
Read more >
a published page repetitively becomes unavailable and the ...
The same page will randomly start returning a 404 error and when I ... Once someone clicks the "Save and publish" button the...
Read more >
scheduled publishing is not working
And one more thing date remain there in text box even after schedule time passed. this is happening on server whereas on local...
Read more >
This document is published but its url cannot be routed
If it's different pages, then instead of immediately publishing the page - check the status of nucache... does rebuilding nucache cache, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found