Project

Profile

Help

Bug #6042

closed

Xerces occasionally throws ArrayIndexOutOfBoundsException

Added by Norm Tovey-Walsh about 1 year ago. Updated 3 months ago.

Status:
Won't fix
Priority:
Low
Assignee:
Category:
Third-party product
Sprint/Milestone:
-
Start date:
2023-05-21
Due date:
% Done:

0%

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

Description

Can't reproduce this locally and debugging through the narrow opening provided by CI is awfully painful, but FYI:

This is xspec.bat (slightly hacked) from the DocBook xslTNG project running on Windows CI in GitHub. I've instrumented the batch file with:

    echo "XSLT:"
    echo %*

The full command is:

    java ^
        -Dfile.encoding=UTF-8 ^
        -Dxspec.coverage.ignore="%TEST_DIR%" ^
        -Dxspec.coverage.xml="%COVERAGE_XML%" ^
        -Dxspec.home="%XSPEC_HOME%" ^
        -Dxspec.xspecfile="%XSPEC%" ^
        -Dorg.docbook.xsltng.extensions.pygmentize="%PYGMENTIZE%" ^
        -Dorg.docbook.xsltng.verbose="%VERBOSE%" ^
        -cp "%CP%" net.sf.saxon.Transform %CATALOG% ^
        -init:org.docbook.xsltng.extensions.Register %*

With Saxon 11.5:

Formatting Report...
"XSLT:"
-o:"D:\a\xslTNG\xslTNG\build\default-result.html"     -s:"D:\a\xslTNG\xslTNG\build\default-result.xml"     -xsl:"D:\a\xslTNG\xslTNG\build\xspec-2.2.4\bin\..\src\reporter\format-xspec-report.xsl"     inline-css=true
java.lang.IllegalStateException: java.lang.ArrayIndexOutOfBoundsException: 2048
	at net.sf.saxon.resource.ActiveSAXSource.deliver(ActiveSAXSource.java:233)
	at net.sf.saxon.resource.ActiveStreamSource.deliver(ActiveStreamSource.java:65)
	at net.sf.saxon.event.Sender.send(Sender.java:105)
	at net.sf.saxon.Configuration.buildDocumentTree(Configuration.java:4138)
	at net.sf.saxon.s9api.DocumentBuilder.build(DocumentBuilder.java:334)
	at net.sf.saxon.Transform.processFile(Transform.java:1346)
	at net.sf.saxon.Transform.doTransform(Transform.java:871)
	at net.sf.saxon.Transform.main(Transform.java:81)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2048
	at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source)
	at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
	at org.apache.xerces.impl.XMLEntityScanner.scanContent(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at net.sf.saxon.resource.ActiveSAXSource.deliver(ActiveSAXSource.java:190)
	... 7 more
Fatal error during transformation: java.lang.IllegalStateException: java.lang.ArrayIndexOutOfBoundsException: 2048
*** Error formatting the report

with Saxon 12.2:

Formatting Report...
"XSLT:"
-o:"D:\a\xslTNG\xslTNG\build\default-result.html"     -s:"D:\a\xslTNG\xslTNG\build\default-result.xml"     -xsl:"D:\a\xslTNG\xslTNG\build\xspec-2.2.4\bin\..\src\reporter\format-xspec-report.xsl"     inline-css=true
java.lang.ArrayIndexOutOfBoundsException: 2048
	at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source)
	at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
	at org.apache.xerces.impl.XMLEntityScanner.scanContent(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at net.sf.saxon.resource.ActiveSAXSource.deliver(ActiveSAXSource.java:190)
	at net.sf.saxon.resource.ActiveStreamSource.deliver(ActiveStreamSource.java:65)
	at net.sf.saxon.event.Sender.send(Sender.java:104)
	at net.sf.saxon.Configuration.buildDocumentTree(Configuration.java:4210)
	at net.sf.saxon.s9api.DocumentBuilder.build(DocumentBuilder.java:334)
	at net.sf.saxon.Transform.processFile(Transform.java:1345)
	at net.sf.saxon.Transform.doTransform(Transform.java:879)
	at net.sf.saxon.Transform.main(Transform.java:83)
Fatal error during transformation: java.lang.ArrayIndexOutOfBoundsException: 2048
*** Error formatting the report

It's particularly annoying that this looks like an encoding issue but I have explicitly specified the file.encoding and the same code on my local Windows machine does not fail.

Actions #1

Updated by Michael Kay about 1 year ago

Sorry, can't provide any suggestions.

It's crashing deep within the Apache Xerces parser. Looks rather like

https://bugs.openjdk.org/browse/JDK-8080085

https://stackoverflow.com/questions/1919687/arrayindexoutofboundsexception-in-xerces-parsing

Actions #2

Updated by Norm Tovey-Walsh about 1 year ago

  • Status changed from New to Rejected

Yes, I concur it's in Xerces. It's completely uncleary how/why Java on Windows is using Xerces, but...not our bug.

Actions #3

Updated by Norm Tovey-Walsh about 1 year ago

Indeed it appears that Xerces 2.9.1 (!) is being pulled in as a transitive dependency. #sigh

Actions #4

Updated by Norm Tovey-Walsh about 1 year ago

  • Status changed from Rejected to AwaitingInfo

I'm reopening this because I now (sometimes, randomly, only on Windows) see it in CI without Xerces:

java.lang.IllegalStateException: java.lang.ArrayIndexOutOfBoundsException: 2048
	at net.sf.saxon.resource.ActiveSAXSource.deliver(ActiveSAXSource.java:233)
	at net.sf.saxon.resource.ActiveStreamSource.deliver(ActiveStreamSource.java:65)
	at net.sf.saxon.event.Sender.send(Sender.java:105)
	at net.sf.saxon.Configuration.buildDocumentTree(Configuration.java:4138)
	at net.sf.saxon.resource.XmlResource.getItem(XmlResource.java:139)
	at net.sf.saxon.functions.CollectionFn.lambda$call$0(CollectionFn.java:261)
	at net.sf.saxon.expr.ItemMapper.mapItem(ItemMapper.java:50)
	at net.sf.saxon.expr.ItemMappingIterator.next(ItemMappingIterator.java:161)
	at net.sf.saxon.om.FocusTrackingIterator.next(FocusTrackingIterator.java:72)
	at net.sf.saxon.expr.instruct.IterateInstr.processLeavingTail(IterateInstr.java:331)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:142)
	at net.sf.saxon.expr.parser.ExpressionTool.getIteratorFromProcessMethod(ExpressionTool.java:678)
	at net.sf.saxon.expr.instruct.Instruction.iterate(Instruction.java:374)
	at net.sf.saxon.expr.CardinalityChecker.evaluateItem(CardinalityChecker.java:280)
	at net.sf.saxon.expr.ItemChecker.evaluateItem(ItemChecker.java:262)
	at net.sf.saxon.expr.parser.Evaluator$SingleItem.evaluate(Evaluator.java:179)
	at net.sf.saxon.expr.parser.Evaluator$SingleItem.evaluate(Evaluator.java:167)
	at net.sf.saxon.expr.LetExpression.eval(LetExpression.java:554)
	at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:746)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:266)
	at net.sf.saxon.trans.XsltController.callTemplate(XsltController.java:873)
	at net.sf.saxon.s9api.Xslt30Transformer.callTemplate(Xslt30Transformer.java:485)
	at net.sf.saxon.Transform.processFile(Transform.java:1376)
	at net.sf.saxon.Transform.doTransform(Transform.java:871)
	at net.sf.saxon.Transform.doTransform(Transform.java:916)
Actions #5

Updated by Michael Kay 8 months ago

Also seeing this occasionally (but not consistently) when running test format-date-008 in the XSLT 3.0 test suite (in particular, with -export:on, so it might occur only when reading the SEF file). Stack trace:

java.lang.ArrayIndexOutOfBoundsException: Index 2048 out of bounds for length 2048
	at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source)
	at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
	at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at net.sf.saxon.resource.ActiveSAXSource.deliver(ActiveSAXSource.java:190)
	at net.sf.saxon.resource.ActiveStreamSource.deliver(ActiveStreamSource.java:65)

Possibly https://issues.apache.org/jira/browse/XERCESJ-1275 or https://issues.apache.org/jira/browse/XERCESJ-1257

Note this was on Mac, not on Windows.

Actions #6

Updated by Michael Kay 8 months ago

  • Subject changed from Odd bug in CI with Saxon 11.5 and 12.2 to Xerces occasionally throws ArrayIndexOutOfBoundsException
Actions #7

Updated by Michael Kay 3 months ago

  • Category set to Third-party product
  • Status changed from AwaitingInfo to Won't fix
  • Assignee set to Michael Kay
  • Applies to branch 10, 11, 12, trunk added
  • Platforms Java added

Marking this as "won't fix" since it's a problem in third-party code and we don't have the capability to fix it.

Please register to edit this issue

Also available in: Atom PDF