[MGNLWORKFLOW-403] Recursive publication crashed instance Created: 16/Dec/20  Updated: 18/Nov/21  Resolved: 28/Oct/21

Status: Closed
Project: Magnolia Workflow Module
Component/s: None
Affects Version/s: 6.0.4
Fix Version/s: 6.0.5

Type: Bug Priority: Critical
Reporter: Jan Schulte Assignee: Nguyen Phung Chi
Resolution: Fixed Votes: 3
Labels: VN-Maintenance, cm-team-support, maintenance, performance
Remaining Estimate: Not Specified
Time Spent: 2d 4h 26m
Original Estimate: Not Specified

Attachments: File createSubpages.groovy     Text File stacktrace.txt    
Issue Links:
Relates
relates to MGNLUI-6686 JcrObservation reacts on irrelevant c... Closed
relates to MGNLUI-6657 LocalManualDatasourceObservation can ... Open
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Release notes required:
Yes
Date of First Response:
Sprint: Content Mngmt 15
Story Points: 2

 Description   

Publishing multiple nodes recursively crashes the author

Steps to reproduce
Take the travel demo and create multiple subpages with the following groovy script createSubpages.groovy

import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import org.apache.commons.lang3.StringUtils;
import info.magnolia.jcr.util.NodeUtil;
import info.magnolia.context.MgnlContext;
import info.magnolia.jcr.util.NodeTypes;
import java.time.Instant;
import java.time.temporal.ChronoUnit;

MAX_DEPTH = 4;
PAGES_PER_LEVEL = 8;
START_NODE_PATH = "/travel";
counter=0;

mapping = new HashMap<>();
mapping.put(1, "a");
mapping.put(2, "b");
mapping.put(3, "c");
mapping.put(4, "d");
mapping.put(5, "e");
mapping.put(6, "f");
mapping.put(7, "g");
mapping.put(8, "h");
mapping.put(9, "i");
mapping.put(10, "j");

void createNodes(Node root, int depth) throws RepositoryException {
        if (depth > MAX_DEPTH) {
            return;
        }

        for (int i = 1; i <= PAGES_PER_LEVEL; ++i) {
            String letter = mapping.get(i);
            letter = StringUtils.isBlank(letter) ? String.valueOf(i) : letter;
            Node node = createNode(root, "Level-" + depth + "-" + letter);
            createNodes(node, depth+1);
        }
        ++depth;
     }

    Node createNode(Node root, String name) throws RepositoryException {
    println "Create Node "+name+" under "+root.getPath();

    Node page = NodeUtil.createPath(root, name, NodeTypes.Page.NAME);
        page.setProperty("title", name);
        page.setProperty("metaKeywords""test");
        page.setProperty("mgnl:created", Calendar.getInstance());
        page.setProperty("mgnl:createdBy""superuser");
        page.setProperty("mgnl:lastModified", Calendar.getInstance());
        page.setProperty("mgnl:lastModifiedBy""superuser");
        page.setProperty("mgnl:template""travel-demo:pages/home");

        createAreaNode(page, "stage");
        createAreaNode(page, "content-main-standard");
        createAreaNode(page, "footer");

        ++counter;
        return page;
}

    void createAreaNode(Node root, String areaName) throws RepositoryException {
        Node area = NodeUtil.createPath(root, areaName, NodeTypes.Area.NAME);
        area.setProperty("mgnl:created", Calendar.getInstance());
        area.setProperty("mgnl:createdBy""superuser");
        area.setProperty("mgnl:lastModified", Calendar.getInstance());
        area.setProperty("mgnl:lastModifiedBy""superuser");
    }

    //////// START Script //////
    println "Start creating TEST DATA "
    Instant start = Instant.now();   
    Session session = MgnlContext.getJCRSession("website");
    Node rootNode = session.getNode(START_NODE_PATH);
    createNodes(rootNode, 1);
    session.save();
    println "Created "+counter+" nodes in "+ChronoUnit.MILLIS.between(start,Instant.now())+" ms"
    println "FINISHED creating TEST DATA "

 
Recursive publish the travel page (action in pages app, click "Publish" in workflow dialog)

Expected
Publication request is done in a reasonable time

Actual

Stack overflow, instance becomes unresponsive
(Actual author session dies, new author session becomes unusable because of a flickering page tree )

2020-12-16 17:15:52,276 ERROR nfo.magnolia.admincentral.AdmincentralErrorHandler: AdmincentralUI has encountered an unhandled exception.
java.util.concurrent.ExecutionException: java.lang.StackOverflowError
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:?]

Workaround
The publish action of the recursive publishing could be configured asynchronous (same as the old pages app).

Updated what have done

  • The actual stack overflow problem has been solved in MGNLUI-6686
  • For this ticket, enabling the asynchronous for the recursive publish action by default in workflow-pages module


 Comments   
Comment by Roman Kovařík [ 04/May/21 ]

Moved to workflow, the publish action of the recursive publishing could be asynchronous (same as the old pages app).
Let's not forget on i18n: workflow-pages.publishRecursive.description.actions.commit.description

The rest could be addressed by MGNLUI-6686

Adding both to backlog.

Comment by Annick Boehler [ 09/Jun/21 ]

Hi, 

may I ask if this issue https://jira.magnolia-cms.com/browse/MGNLUI-6657 will be fixed within this ticket?

thanks 

Generated at Mon Feb 12 10:09:43 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.