Exception thrown in ExtensionFunctionCall prevents thread pool shutdown
When exception is thrown in ExtensionFunctionCall.call method used inside for-each with multi-threaded processing enabled (saxon:threads attribute) then uderlying thread pool is not shutdow.
After running example (files: SaxonThreads.java, test.xslt, input.xml) you should be able to reproduce this problem. On attached screenshot (threads_count.jpg) from jconsole you can see number of threads in example program, after first few iterations exception is being thrown, and from this moment number of threads only increases.
Tested on version 18.104.22.168 and 22.214.171.124 with EE-T license.
#1 Updated by Michael Kay 11 months ago
- Category set to Multithreading
- Assignee set to Michael Kay
Thanks for reporting this. I have reproduced the problem, and I think it can be fixed quite easily.
I don't think the problem is particular to exceptions thrown by extension functions, it can probably be triggered by any dynamic error occurring within the multithreaded xsl:for-each.
#2 Updated by Michael Kay 11 months ago
Added an xslt3extra test case threads-029 which does a divide-by-zero within the loop.
This is failing slightly differently, with a
MultithreadedContextMappingIterator.mapOneItem(). I'm not entirely sure what causes the two tests to fail in slightly different ways, but the remedy appears to be the same: when the exception is caught, call
close() to shut down the
#3 Updated by Michael Kay 11 months ago
The difference between the two cases is that in one case, the call on
expression.iterate() fails, while in the other the call on
expression.iterate() returns an iterator and the call on
iterator.next() fails. We should try and construct test cases for both situations...
Please register to edit this issue