Bug #4788
closedException thrown in ExtensionFunctionCall prevents thread pool shutdown
100%
Description
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 9.7.0.21 and 9.9.1.7 with EE-T license.
Files
Updated by Michael Kay about 4 years 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.
Updated by Michael Kay about 4 years ago
Added an xslt3extra test case threads-029 which does a divide-by-zero within the loop.
This is failing slightly differently, with a RejectedExecutionException
within 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 ExecutorService
Updated by Michael Kay about 4 years 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...
Updated by Michael Kay about 4 years ago
- Status changed from New to Resolved
- Fix Committed on Branch 10, 9.9, trunk added
Added xslt30extra test cases threads-029, -030, and -031. Fix committed on 9.9, 10.x, and 11.x branches
Updated by O'Neil Delpratt about 4 years ago
- Fixed in Maintenance Release 9.9.1.8 added
Bug fix applied on the Saxon 9.9.1.8 maintenance release. Leaving open until applied on the Saxon 10 maintenance release.
Updated by O'Neil Delpratt about 4 years ago
Bug fix applied in the Saxon 10.3 maintenance release
Updated by O'Neil Delpratt about 4 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 10.3 added
Updated by Eryk Rzeźnik over 3 years ago
I've tested attached example with versions 9.9.1.8 and 10.3, bugfix seems to work in 9.9.1.8, but in version 10.3 thread pool still is not closed after exception.
Can you confirm that this bugfix was actually applied on 10.3 version.
Updated by Michael Kay over 3 years ago
- Status changed from Closed to In Progress
I've checked the commit logs and it seems there were three changes made on the 9.9 branch and only two of them were applied to the 10.x branch.
Updated by Michael Kay over 3 years ago
- Status changed from In Progress to Resolved
- Applies to branch 10, trunk added
- Applies to branch deleted (
9.7, 9.9)
I've now generated an automated unit test for this, and the patch is applied and tested on the 10.x and 11.x branches.
Updated by O'Neil Delpratt over 3 years ago
- Status changed from Resolved to Closed
- Fixed in Maintenance Release 10.5 added
- Fixed in Maintenance Release deleted (
9.9.1.8, 10.3)
Bug fix applied to Saxon 10.5 maintenance release.
Please register to edit this issue