Nested multithreaded xsl:for-each
Saxon-EE allows an xsl:for-each instruction to operate in multithreaded mode by specifying the extension attribute saxon:threads="N".
This fails (typically causing the VM to hang) if several concurrent executions of the same multithreaded xsl:for-each instruction occur in parallel.
This might happen because the multithreaded xsl:for-each is nested (statically or dynamically) in another multithreaded xsl:for-each, or because the stylesheet containing the multithreaded xsl:for-each instruction is itself executed several times in parallel, for example by creating several XsltTransformer instances from the same XsltExecutable.
The problem has been re-created in a reproduceable test case, and a patch has been tested on the 9.6 branch.
#1 Updated by Michael Kay over 5 years ago
- Status changed from New to Resolved
Now fixed on the 9.5, 9.6, and 9.7 branches.
The problem was that two variables (maxThreads and executionPool) evaluated during the course of evaluating the xsl:for-each instruction are held in instance-level variables of the MultithreadedForEach class, which is an expression class and therefore part of the compiled stylesheet, which is supposed to be threadsafe. It proved easy to change these to local variables held on stack.
The test case used was an adapted version of XSLT 3 test case catalog-005, adapted to put saxon:threads on two nested loops. No permanent test case has been created.
Please register to edit this issue