Project

Profile

Help

Bug #2220

closed

Multithreading: concurrent creation of "prior pointers" in TinyTree

Added by Michael Kay over 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Multithreading
Sprint/Milestone:
-
Start date:
2014-11-14
Due date:
% Done:

0%

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

Description

Reported today by private email, an intermittent fault with a stacktrace like this:

net.sf.saxon.trans.XPathException: java.lang.ArrayIndexOutOfBoundsException: 7961

    at com.saxonica.stream.SequenceExchanger$EvaluationThread.run(SequenceExchanger.java:225)

    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

    at java.lang.Thread.run(Thread.java:662)

Caused by: java.lang.ArrayIndexOutOfBoundsException: 7961

    at net.sf.saxon.tree.tiny.TinyTree.makePriorIndex(TinyTree.java:770)

    at net.sf.saxon.tree.tiny.TinyTree.ensurePriorIndex(TinyTree.java:760)

    at net.sf.saxon.tree.tiny.PrecedingSiblingEnumeration.<init>(PrecedingSiblingEnumeration.java:31)

    at net.sf.saxon.tree.tiny.TinyNodeImpl.iterateAxis(TinyNodeImpl.java:491)

    at gen_CompiledFilterIterator_3.matches(file:///opt1/mcs_dev/datafiles/xslt/current/stressBasedMargin.xslt:65535)

    at com.saxonica.bytecode.iter.CompiledFilterIterator.next(CompiledFilterIterator.java:49)

    at net.sf.saxon.value.SequenceExtent.<init>(SequenceExtent.java:112)

    at net.sf.saxon.expr.sort.DocumentOrderIterator.<init>(DocumentOrderIterator.java:38)

I think the stack trace makes it clear what's going on. It's not one we've seen before.

There are concurrent threads running, and the code is putting "prior" pointers into the tinytree. These pointers are only needed if the code uses a backwards axis (preceding-sibling), so to save space, they are only created when first needed. I suspect the "first need" is occurring within parallel threads so two threads are trying to create the prior pointers at the same time, causing data corruption and an arbitrary crash.

Found in 9.5.1.8 but the problem is likely to be present also in earlier and later releases

Please register to edit this issue

Also available in: Atom PDF