Bug #3694
Updated by Michael Kay over 6 years ago
*Summary
This problem arises when a template rule is defined in more than one mode, and when JIT is enabled (which is the default), and when the first activations of the template rule in two different modes occur in different threads. Several threads initializing the template rule simultaneously can then interfere with each other. The observed problem was with allocation of slot numbers to local variables, but it could manifest itself with different symptoms.*
Hello,
The attached archive contains the TEI XSLTs. If I run the following line a couple of times (the ThreadManagerEE from the exception makes me believe this is a threading issue) I will eventually hit the exception from below. Deactivating the optimizations appears to fix the issue (again, being a threading issue I can't tell for sure).
<pre>
java -cp saxon9ee.jar net.sf.saxon.Transform -s:TEI-Lite-P5-documentation.xml -xsl:stylesheet\profiles\default\epub\to.xsl -o:index.html
</pre>
<pre>
java.util.concurrent.ExecutionException: java.lang.AssertionError: Internal error: Cannot set local variable: no slot allocated
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at com.saxonica.ee.trans.ThreadManagerEE.waitForChildThreads(ThreadManagerEE.java:83)
at net.sf.saxon.expr.XPathContextMajor.waitForChildThreads(XPathContextMajor.java:221)
at net.sf.saxon.Controller.transformDocument(Controller.java:2421)
at net.sf.saxon.Controller.transform(Controller.java:1970)
at net.sf.saxon.s9api.Xslt30Transformer.applyTemplates(Xslt30Transformer.java:593)
at net.sf.saxon.Transform.processFile(Transform.java:1259)
at net.sf.saxon.Transform.doTransform(Transform.java:782)
at net.sf.saxon.Transform.main(Transform.java:81)
Caused by: java.lang.AssertionError: Internal error: Cannot set local variable: no slot allocated
at net.sf.saxon.expr.XPathContextMinor.setLocalVariable(XPathContextMinor.java:324)
at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:693)
at net.sf.saxon.expr.instruct.Choose.processLeavingTail(Choose.java:879)
at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:347)
at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502)
at net.sf.saxon.expr.instruct.ApplyTemplates.apply(ApplyTemplates.java:295)
at net.sf.saxon.expr.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:252)
at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:687)
at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:347)
at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502)
at net.sf.saxon.expr.instruct.ApplyTemplates.apply(ApplyTemplates.java:295)
at net.sf.saxon.expr.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:252)
at net.sf.saxon.expr.instruct.Choose.processLeavingTail(Choose.java:879)
at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:151)
at net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:472)
at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:151)
at net.sf.saxon.expr.instruct.DocumentInstr.evaluateItem(DocumentInstr.java:302)
at net.sf.saxon.expr.instruct.DocumentInstr.evaluateItem(DocumentInstr.java:50)
at net.sf.saxon.expr.parser.ExpressionTool.evaluate(ExpressionTool.java:328)
at net.sf.saxon.expr.LetExpression.eval(LetExpression.java:511)
at net.sf.saxon.expr.LetExpression.process(LetExpression.java:580)
at com.saxonica.ee.bytecode.ByteCodeCandidate.process(ByteCodeCandidate.java:141)
at net.sf.saxon.expr.parser.ExpressionTool.evaluate(ExpressionTool.java:350)
at net.sf.saxon.expr.instruct.UserFunction.call(UserFunction.java:616)
at net.sf.saxon.expr.UserFunctionCall.callFunction(UserFunctionCall.java:541)
at net.sf.saxon.expr.UserFunctionCall.iterate(UserFunctionCall.java:487)
at net.sf.saxon.expr.AdjacentTextNodeMerger.iterate(AdjacentTextNodeMerger.java:229)
at net.sf.saxon.expr.Atomizer.iterate(Atomizer.java:321)
at net.sf.saxon.expr.AtomicSequenceConverter.iterate(AtomicSequenceConverter.java:266)
at net.sf.saxon.expr.parser.Evaluator$5.evaluate(Evaluator.java:101)
at net.sf.saxon.expr.SystemFunctionCall.evaluateArguments(SystemFunctionCall.java:448)
at net.sf.saxon.expr.FunctionCall.iterate(FunctionCall.java:545)
at net.sf.saxon.expr.Expression.evaluateItem(Expression.java:840)
at net.sf.saxon.expr.Expression.evaluateAsString(Expression.java:899)
at net.sf.saxon.expr.instruct.SimpleNodeConstructor.processLeavingTail(SimpleNodeConstructor.java:218)
at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:687)
at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:151)
at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:337)
at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:284)
at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:687)
at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:151)
at com.saxonica.ee.bytecode.ByteCodeCandidate.process(ByteCodeCandidate.java:141)
at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:264)
at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:353)
at net.sf.saxon.expr.instruct.CallTemplate.processLeavingTail(CallTemplate.java:411)
at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:687)
at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:151)
at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:337)
at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:284)
at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:151)
at net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:472)
at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:151)
at net.sf.saxon.expr.LetExpression.process(LetExpression.java:588)
at com.saxonica.ee.bytecode.ByteCodeCandidate.process(ByteCodeCandidate.java:141)
at net.sf.saxon.expr.instruct.UserFunction.process(UserFunction.java:650)
at net.sf.saxon.expr.UserFunctionCall.process(UserFunctionCall.java:589)
at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:689)
at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:151)
at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:337)
at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:284)
at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:151)
at com.saxonica.ee.bytecode.ByteCodeCandidate.process(ByteCodeCandidate.java:141)
at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:264)
at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:353)
at net.sf.saxon.expr.instruct.ResultDocument.processInstruction(ResultDocument.java:480)
at com.saxonica.config.EnterpriseConfiguration$5.call(EnterpriseConfiguration.java:1973)
at com.saxonica.config.EnterpriseConfiguration$5.call(EnterpriseConfiguration.java:1969)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
</pre>