Project

Profile

Help

Random ArrayIndexOutOfBounds exception

Added by Anonymous over 15 years ago

Legacy ID: #5289085 Legacy Poster: Pierre Candela (pcandela)

Hi, I'm using Saxon-B 9.0.0.2 and I sometimes get an AIOOB exception (stacktrace below). By reading the release notes for the more recent versions, I noticed that some AIOOB issues were fixed since 9.0.0.2. But I'm not sure whether they address my particular problem. Has anyone else encountered this before? Thanks for your help, Pierre java.lang.ArrayIndexOutOfBoundsException: -1 at net.sf.saxon.tinytree.TinyNodeImpl.isAncestorOrSelf(TinyNodeImpl.java:707) at net.sf.saxon.om.Navigator.isAncestorOrSelf(Navigator.java:814) at net.sf.saxon.functions.KeyFn$SubtreeFilter.map(KeyFn.java:307) at net.sf.saxon.expr.ItemMappingIterator.next(ItemMappingIterator.java:46) at net.sf.saxon.value.MemoClosure$ProgressiveIterator.next(MemoClosure.java:327) at net.sf.saxon.functions.Existence.effectiveBooleanValue(Existence.java:109) at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:618) at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:551) at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:625) at net.sf.saxon.instruct.Instruction.process(Instruction.java:94) at net.sf.saxon.instruct.UserFunction.process(UserFunction.java:347) at net.sf.saxon.expr.UserFunctionCall.process(UserFunctionCall.java:417) at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:627) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Instruction.process(Instruction.java:94) at net.sf.saxon.instruct.UserFunction.process(UserFunction.java:347) at net.sf.saxon.expr.UserFunctionCall.process(UserFunctionCall.java:417) at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:627) at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:551) at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:175) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:343) at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:208) at net.sf.saxon.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:172) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Instruction.process(Instruction.java:94) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298) at net.sf.saxon.instruct.Copy.processLeavingTail(Copy.java:205) at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:175) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:343) at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:208) at net.sf.saxon.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:172) at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:625) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Instruction.process(Instruction.java:94) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298) at net.sf.saxon.instruct.Copy.processLeavingTail(Copy.java:205) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:175) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:343) at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:208) at net.sf.saxon.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:172) at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:625) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Instruction.process(Instruction.java:94) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298) at net.sf.saxon.instruct.Copy.processLeavingTail(Copy.java:205) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:175) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:343) at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:208) at net.sf.saxon.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:172) at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:625) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Instruction.process(Instruction.java:94) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298) at net.sf.saxon.instruct.Copy.processLeavingTail(Copy.java:205) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:175) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:343) at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:208) at net.sf.saxon.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:172) at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:625) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Instruction.process(Instruction.java:94) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298) at net.sf.saxon.instruct.Copy.processLeavingTail(Copy.java:205) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:175) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:343) at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:208) at net.sf.saxon.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:172) at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:625) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Instruction.process(Instruction.java:94) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298) at net.sf.saxon.instruct.Copy.processLeavingTail(Copy.java:205) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:175) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:343) at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:208) at net.sf.saxon.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:172) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Instruction.process(Instruction.java:94) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298) at net.sf.saxon.instruct.Copy.processLeavingTail(Copy.java:205) at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:625) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:399) at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:175) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:343) at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:376) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:331) at net.sf.saxon.Controller.transformDocument(Controller.java:1735) at net.sf.saxon.Controller.transform(Controller.java:1559)


Replies (6)

Please register to reply

RE: Random ArrayIndexOutOfBounds exception - Added by Anonymous over 15 years ago

Legacy ID: #5298677 Legacy Poster: Michael Kay (mhkay)

I think this is a new problem. It's crashed in code that has been stable for many releases, but is not heavily used. The code is testing whether a node found via an xsl:key index is within the subtree rooted at the node specified in the third argument to the key() function. I can't see any obvious flaw in the logic at the point where it has crashed, so I really need to be able to reproduce it to make any progress. If you can try and put together a self-contained repro, I would be grateful. Ideally, please check that it still fails on the latest release (9.1.0.2), but I suspect that it will. Michael Kay

RE: Random ArrayIndexOutOfBounds exception - Added by Anonymous over 15 years ago

Legacy ID: #5315690 Legacy Poster: Pierre Candela (pcandela)

Hi Michael, I've been trying to reproduce it with 9.0.0.8 and 9.1.0.2 but I haven't succeeded yet. As this problem happened once in a blue moon, I don't know whether I've been "lucky" up until now or whether it is fixed in the latest versions. I'll continue my tests and report back if I manage to make it crash. For the self-contained repro, should I limit myself to using the 3-argument version of the key function? Or can the 2-argument version be affected as well? Regards, Pierre

RE: Random ArrayIndexOutOfBounds exception - Added by Anonymous over 15 years ago

Legacy ID: #5315905 Legacy Poster: Michael Kay (mhkay)

I think the path that it crashed on is specific to the 3-argument key() function. And it probably depends on the exact nature of the source document. Michael Kay

RE: Random ArrayIndexOutOfBounds exception - Added by Anonymous over 15 years ago

Legacy ID: #5379576 Legacy Poster: Michael Kay (mhkay)

I've reproduced the exception by means of an internal test invoking the method TinyNodeImpl.isAncestorOrSelf(n), where the target node is the document node and n is the outermost element. What I haven't been able to do is to find an external XSLT or XQuery test that triggers such a call: the method isAncestorOrSelf() is only called while executing the key() function, the target node is the value of the 3rd argument (which defaults to "/"), and the method is normally not called if the value of the 3rd argument is the root node of the tree. But the internal code ought to handle this case and doesn't, even if the key() function doesn't use it, so I'll raise a patch for it.

RE: Random ArrayIndexOutOfBounds exception - Added by Anonymous over 15 years ago

Legacy ID: #5480361 Legacy Poster: Pierre Candela (pcandela)

Thanks, Michael, for fixing this bug. Sorry I didn't get back to you any sooner. After looking at the xslt code, here's what I found out: 1) I only use the 3-argument version of the key function when inside an xsl:function element 2) as there is no context node inside an xsl:function, I applied what you suggested here: http://www.stylusstudio.com/xsllist/200504/post10240.html ie: - I use the global variable, when searching the principal source document - I pass the document as an extra parameter to the xsl:function, when searching another document. This document is created with the document($href) function, where the function doc-available($href) returns true. Does it confirm your findings? I noticed that you patched the 9.0 and 9.1 branches but you haven't released a new 9.0 version yet. Are you planning to? If not, if I upgrade my application to 9.1.0.3, are there any incompatibilty issue(s) between 9.0.0.X and 9.1.0.X I should be aware of? Regards, Pierre

RE: Random ArrayIndexOutOfBounds exception - Added by Anonymous over 15 years ago

Legacy ID: #5480585 Legacy Poster: Michael Kay (mhkay)

Thanks for the description of your code, but it doesn't help. It's frustrating that you can't show me the actual code. I think the bug is fixed, but without a repro I can't be 100% sure, and it's irritating that I can't see any way to make real XSLT code trigger it. There's a complete list of changes produced with each new Saxon release, but to be honest the quickest way of discovering whether you're dependent on any of the things that have changed is to try it and see. On the whole, for most people, it's unlikely you will notice any differences. I've been putting 9.0 versions of patches in Subversion just in case (a) anyone wants to apply them to their own build, or (b) one of my paying customers decides they need a new 9.0 build with the changes applied (which happens from time to time). I'm unlikely to do another build "for free" unless some compelling reason emerges.

    (1-6/6)

    Please register to reply