Project

Profile

Help

Bug #4523

"XError: looping???" from tokenize

Added by Debbie Lockett 4 months ago. Updated 4 months ago.

Status:
Resolved
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
2020-04-20
Due date:
% Done:

0%

Estimated time:
Applies to JS Branch:
1.0
Fix Committed on JS Branch:
1.0
Fixed in JS Release:
SEF Generated with:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

Syd Bauman shared issue on saxon-help list:

"If I try to access a variable that has a long string I get an "XError: looping???" error. [...]

To see a nicely set up (if I do say so myself) demonstration and description of the bug (1), see https://bauman.zapto.org/~syd/temp/transfer/bug_demo.tgz

That tarball includes three files:

  • bug_demo.html: a host HTML file with a detailed description,
  • bug_demo.xml: a source XML document designed to make it easy to see how many words should be reported, and
  • bug_demo.xslt: an XSLT program that does very little above and beyond what is necessary to throw the error.

P.S. Just accessing the string isn't the problem, of course. E.g., string-length() seems to work."

bug_demo.html (4.9 KB) bug_demo.html Debbie Lockett, 2020-04-20 13:16
bug_demo.xml (8.77 KB) bug_demo.xml Debbie Lockett, 2020-04-20 13:16
bug_demo.xslt (1.95 KB) bug_demo.xslt Debbie Lockett, 2020-04-20 13:16

History

#2 Updated by Debbie Lockett 4 months ago

  • Status changed from New to In Progress

The error is thrown from the analyze function in Expr.js in Saxon-JS 1.2.0:

            if (loops++ > 1000) {
                throw XError("looping???", "SXJS0004");
            }

This analyze function is called from analyze-string and tokenize in CoreFn.js, and formatNumberSeq in Numberer.js.

Note that the error still exists in Saxon-JS 2.0 code, but has been slightly updated. The relevant analyze function in now found in Push.js:

            if (loops++ > input.length * 10) {
                throw new XError("analyze-string looping???", "SXJS0004");
            }

I see the error thrown running the demo with Saxon-JS 1.2.0, but not with Saxon-JS 2.0; I guess because of the loops++ > condition change.

#3 Updated by Michael Kay 4 months ago

That would be the problem then: Syd says he was using a very long string; if it contains more than 1,000 tokens then we're going to get this error, and the 2.0 change should fix it.

#4 Updated by Debbie Lockett 4 months ago

  • Status changed from In Progress to Resolved
  • Fix Committed on JS Branch 1.0 added

Copied 2.0 change for loops++ > condition to Saxon-JS 1 branch, and committed. (The error message is just left as is, because the error shouldn't ever actually happen...)

Please register to edit this issue

Also available in: Atom PDF Tracking page