Bug #6425
closedWhen the saxon:thread attribute is set for xsl:for-each in saxon-ee-12.4 (enterprise edition), NullPointException and ClassCastException occasionally occur in multi-thread scenarios.
0%
Description
When the saxon:thread attribute is set for xsl:for-each in saxon-ee-12.4 (enterprise edition), NullPointException and ClassCastException occasionally occur in multi-thread scenarios.
Caused by: java.lang.NullPointerException at net.sf.saxon.expr.XPathContextMajor.getTargetComponent(XPathContextMajor.java:684) at net.sf.saxon.expr.instruct.ApplyTemplates.getTargetMode(ApplyTemplates.java:303) at net.sf.saxon.expr.instruct.ApplyTemplates$ApplyTemplatesElaborator.lambda$elaborateForPush$1(ApplyTemplates.java:613) at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$4(Block.java:895) at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:376)
or
Caused by: java.lang.ClassCastException: net.sf.saxon.expr.Component cannot be cast to net.sf.saxon.expr.Component$M at net.sf.saxon.expr.instruct.ApplyTemplates.getTargetMode(ApplyTemplates.java:303) at net.sf.saxon.expr.instruct.ApplyTemplates$ApplyTemplatesElaborator.lambda$elaborateForPush$1(ApplyTemplates.java:613) at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$4(Block.java:895) at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:376)
Cause: processComponentReference method of net.sf.saxon.expr.instruct.Actor
int slot = bindings.size();
ComponentBinding cb = new ComponentBinding(name, target);
bindings.add(cb);
invocation.setBindingSlot(slot);
The operation of obtaining the slot and adding the slot to the bindings is not an atomic operation. In the multi-thread scenario, the positions of the slot and bindings may be mismatched or overwritten.
Solution (s): Ensure that the slot obtaining and adding operations are atomic and the performance in multi-thread scenarios is ensured.:
Related issues
Please register to edit this issue