Support #4903
closedStack overflow caused by recursive calls to DescendantEnumeration.next
0%
Description
During checkstyle report generation by maven-checkstyle-plugin, Saxon fails with java.lang.StackOverflowError
on deeply concatenated strings. Full checkstyle issue and full report found here: https://github.com/checkstyle/checkstyle/issues/9267
Excerpt from failing CI:
Caused by: java.lang.StackOverflowError13:23
at com.puppycrawl.tools.checkstyle.xpath.ElementNode.createChildren(ElementNode.java:147)13:23
at com.puppycrawl.tools.checkstyle.xpath.AbstractNode.getChildren(AbstractNode.java:95)13:23
at com.puppycrawl.tools.checkstyle.xpath.ElementNode.iterateAxis(ElementNode.java:251)13:23
at net.sf.saxon.tree.util.Navigator$DescendantEnumeration.next(Navigator.java:1352)13:23
at net.sf.saxon.tree.util.Navigator$DescendantEnumeration.next(Navigator.java:1315)13:23
13:23
at net.sf.saxon.tree.util.Navigator$DescendantEnumeration.next(Navigator.java:1315)13:23
at net.sf.saxon.tree.util.Navigator$DescendantEnumeration.next(Navigator.java:1315)13:23
at net.sf.saxon.tree.util.Navigator$DescendantEnumeration.next(Navigator.java:1315)13:23
at net.sf.saxon.tree.util.Navigator$DescendantEnumeration.next(Navigator.java:1315)13:23
at net.sf.saxon.tree.util.Navigator$DescendantEnumeration.next(Navigator.java:1315)13:23
...
Please let me know if there are any other details I can provide!
Updated by Michael Kay about 3 years ago
(a) How deep is the tree? It's reasonable I think for the descendant axis to use recursion, and this means that the depth of the tree is going to be limited by the stack available.
(b) Navigator.DescendantEnumeration is used primarily for navigating external tree models such as the DOM or JDOM. What tree model are you using? By far the most efficient (and the one on which we concentrate our optimisation efforts) is the Saxon TinyTree, and this does not use recursion to navigate the descendant axis.
Some notes on the implementation of the descendant axis with different tree models can be found here:
https://dev.saxonica.com/blog/mike/2012/09/comparing-dom-and-other-object-models.html
Updated by Michael Kay about 3 years ago
- Status changed from New to AwaitingInfo
Changing the status to "AwaitingInfo" - I'm not proposing to take any further action unless we hear back from you.
Updated by Michael Kay about 3 years ago
- Tracker changed from Bug to Support
- Status changed from AwaitingInfo to Closed
Closing this, since no further information was received. Feel free to reopen if more evidence becomes available.
Please register to edit this issue