Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5284

Too deep recursion in AbstractHierarchyIterator

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.9.1
    • Fix Version/s: 7.0.0-M1, 6.15.0
    • Component/s: wicket
    • Labels:
      None

      Description

      In application we have code as follows:

      MarkupContainer mc = ...;
      ComponentHierarchyIterator iter = mc.visitChildren(FormComponent.class);
      for (Component c : iter)

      { ... }

      However, when run, on many pages this causes java.lang.StackOverflowError, with lots of the stacktrace filled with lines like this:

      ...
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.moveUp(AbstractHierarchyIterator.java:302)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.moveUp(AbstractHierarchyIterator.java:302)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.nextNode(AbstractHierarchyIterator.java:259)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.moveDown(AbstractHierarchyIterator.java:170)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.nextNode(AbstractHierarchyIterator.java:236)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.moveUp(AbstractHierarchyIterator.java:297)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.nextNode(AbstractHierarchyIterator.java:259)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.moveDown(AbstractHierarchyIterator.java:170)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.nextNode(AbstractHierarchyIterator.java:236)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.moveDown(AbstractHierarchyIterator.java:170)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.nextNode(AbstractHierarchyIterator.java:236)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.moveDown(AbstractHierarchyIterator.java:170)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.nextNode(AbstractHierarchyIterator.java:236)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.moveDown(AbstractHierarchyIterator.java:170)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.nextNode(AbstractHierarchyIterator.java:236)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.moveUp(AbstractHierarchyIterator.java:297)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.moveUp(AbstractHierarchyIterator.java:302)
      org.apache.wicket.util.iterator.AbstractHierarchyIterator.nextNode(AbstractHierarchyIterator.java:259)
      ...

      It seems that the search for next component in the iteration produces too deep recursion here (not infinite, but too deep for processing a typical page with relatively lots of components) and I suspect that the length of the stack used by the iterator is proportional to the total number of components in the page.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mgrigorov Martin Tzvetanov Grigorov
                Reporter:
                mpl Martin Petricek
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: