Uploaded image for project: 'Magnolia Workflow Module'
  1. Magnolia Workflow Module
  2. MGNLWORKFLOW-403

Recursive publication crashed instance

    XMLWordPrintable

Details

    • Yes
    • Content Mngmt 15
    • 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

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                nguyen.phung Nguyen Phung Chi
                jschulte Jan Schulte
                Votes:
                3 Vote for this issue
                Watchers:
                12 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD

                    Jenkins Builds

                      No builds found.