Project

Profile

Help

Bug #5600

closed

Stack Overflow traversing an array that was built incrementally

Added by Joel Kalvesmaki over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Performance
Sprint/Milestone:
-
Start date:
2022-07-13
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
10, 11, trunk
Fix Committed on Branch:
11, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

I have stumbled across a bug that shows up only when running Saxon from Java, not in Oxygen.

In the attached stylesheet, an array is sent through tan:array-permutations(), which normally returns an array with 12,288 items. It does so very quickly in Oxygen (v. 24.1).

But when I call this stylesheet from a Java-based application, using Saxon 10.3, 10.8, and 11.3 HE, I get the following error:

Exception in thread "main" java.lang.StackOverflowError
	at net.sf.saxon.ma.parray.ImmList2.iterator(ImmList2.java:120)
        . . . . . . .
        [PREVIOUS LINE REPEATED ABOUT 1000 TIMES]

When the population of the first member of $test-array is reduced by say 36 items, then it works fine in Java.

I first encountered the problem in another context with the cryptic SXLM0001 Too any nested function calls. May be due to infinite recursion. After about four hours of troubleshooting, I isolated the problem to the example in the attached stylesheet.

In Java I'm working with IntelliJ 2021.2.3 build #IC-212.5457.46


Files

iteration-bug.xsl (5.35 KB) iteration-bug.xsl Stylesheet demonstrating iteration problem Joel Kalvesmaki, 2022-07-13 05:42

Please register to edit this issue

Also available in: Atom PDF