Project

Profile

Help

Bug #4903

Stack overflow caused by recursive calls to DescendantEnumeration.next

Added by Nick Mancuso 14 days ago. Updated 14 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Maven
Sprint/Milestone:
-
Start date:
2021-02-12
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:

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!

History

#1 Updated by Michael Kay 14 days 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

Please register to edit this issue

Also available in: Atom PDF