Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rapid updates fo content types can cause process and site to hang. #17550

Open
KevinJump opened this issue Nov 15, 2024 · 1 comment
Open

Rapid updates fo content types can cause process and site to hang. #17550

KevinJump opened this issue Nov 15, 2024 · 1 comment
Labels
state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks type/bug

Comments

@KevinJump
Copy link
Contributor

KevinJump commented Nov 15, 2024

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

v15.0.0

Bug summary

If you update a number of content types in quick succession, then intermintently the process may hang and the site migh become unresponsive.

Specifics

calling the UpdateAsync method for multiple content types can cause the process to hang (it doesn't appear to come back).

Steps to reproduce

With Umbraco v15 and the Clean starter kit installed (purely to get some content on the site - i have checked the starter kit has no notification handlers).

dotnet new install Umbraco.Templates::15.0.0
dotnet new umbraco -n UmbracoUpdateSite
cd ,/UmbracoUpdateSite
dotnet add package Clean 
dotnet run

the following code on the site will give you an ApiController that update all the content types (toggling their icon each time).

https://localhost:[port]/umbraco/test/update

using Microsoft.AspNetCore.Mvc;

using System.Diagnostics;

using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Web.Common.Routing;

namespace UmbracoUpdateSite.Controller;

[ApiController]
[BackOfficeRoute("test")]
public class ContentTypeUpdateController : ControllerBase
{
    private readonly IContentTypeService _contentTypeService;
    private readonly ILogger<ContentTypeUpdateController> _logger;

    public ContentTypeUpdateController(
        IContentTypeService contentTypeService,
        ILogger<ContentTypeUpdateController> logger)
    {
        _contentTypeService = contentTypeService;
        _logger = logger;
    }

    [HttpGet("update")]
    public async Task<string> Update()
    {
        var allContentTypes = _contentTypeService.GetAll().ToList();

        var sw = Stopwatch.StartNew();

        foreach (var contentType in allContentTypes)
        {
            // swap the icon, so that there is a change. 
            contentType.Icon = contentType.Icon == "icon-document" ? "icon-star" : "icon-document";

            // slow it down and it works...
            // Thread.Sleep(100); 

            // update the content type. 
            _logger.LogInformation("Updating: {alias}", contentType.Alias);
            await _contentTypeService.UpdateAsync(contentType, Constants.Security.SuperUserKey);
            _logger.LogInformation("Updated: {alias}", contentType.Alias);
        }

        sw.Stop();
        return $"Updated : {allContentTypes.Count} in {sw.ElapsedMilliseconds}ms";
    }
}

callling this can work, (and might work quite a few times, and it returns a result.

image

however, if you run it 4 or 5 times it will fail, (sometimes the first time, something later)

When this happens, you can no longer get into the back office of the site. (although i was able to get via the logs once)

restarting the site, shows the site hung between the two log entries,

image

(Last log entry before the site was restarted was Updating "article list")

Expected result / actual result

I now this example is a little extreme, but it has been simplifed, so it can be tested, I don't know but it feels like a deadlock somewhere?


This item has been added to our backlog AB#46056

Copy link

Hi there @KevinJump!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@bergmania bergmania added the state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks label Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks type/bug
Projects
None yet
Development

No branches or pull requests

2 participants