Project

Profile

Help

Bug #597

closed

saxon:evaluate() isn't thread-safe

Added by Anonymous about 19 years ago. Updated about 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
Due date:
% Done:

0%

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

Description

SourceForge user: mhkay

The saxon:evaluate() extension function causes a static

context for the XPath expression to be established when

the containing stylesheet (or query) is compiled. This

static context is then modified, by declaring the

variables $p1..$p9, when the XPath expression is

compiled, that is, when the saxon:evaluate()

instruction is executed.

This has two adverse consequences:

(a) saxon:evaluate is not thread-safe: undefined errors

may occur if it is used in a compiled stylesheet or

query that is executed in multiple threads concurrently

(b) performance gradually degrades when a compiled

stylesheet or query containing calls to saxon:evaluate

is serially reused.

The problem applies to 8.3 and 8.2, and possibly

earlier releases.

A patch is provided. This is in two parts.

(a) replace the module net.sf.saxon.functions.Evaluate

with the new version attached.

(b) add the following method to module

net.sf.saxon.trans.IndependentContext

/**

 * Create a copy of this IndependentContext. All

aspects of the context are copied

 * except for declared variables.

 */


public IndependentContext copy() {

    IndependentContext ic = new

IndependentContext(config);

    ic.namespaces = new HashMap(namespaces);

    ic.collations = new HashMap(collations);

    ic.variables = new HashMap();

    ic.defaultCollationName = defaultCollationName;

    ic.baseURI = baseURI;

    ic.locationMap = locationMap;

    ic.functionLibrary = functionLibrary;

    ic.defaultFunctionNamespace =

defaultFunctionNamespace;

    ic.schemaImporter = schemaImporter;

    ic.externalResolver = externalResolver;

    return ic;

}

Files

Evaluate.java (9.56 KB) Evaluate.java Anonymous, 2005-02-19 09:28

No data to display

Please register to edit this issue

Also available in: Atom PDF