Project

Profile

Help

Bug #6425

closed

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.

Added by lu zhang 6 months ago. Updated 6 months ago.

Status:
Duplicate
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2024-05-15
Due date:
2024-06-30
% Done:

0%

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

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

Is duplicate of Saxon - Bug #6348: net.sf.saxon.expr.XPathContextMajor.getTargetComponent throws NullPointerException - race conditionClosedMichael Kay2024-02-15

Actions

Please register to edit this issue

Also available in: Atom PDF