Project

Profile

Help

Bug #4075

closed

<xsl:for-each saxon:threads="8"> fails with RejectedExecutionException

Added by Michael Kay over 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Multithreading
Sprint/Milestone:
-
Start date:
2018-12-20
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.9, trunk
Fix Committed on Branch:
9.9, trunk
Fixed in Maintenance Release:
Platforms:

Description

I added saxon:threads="8" to a working stylesheet and it ran successfully for a while, then failed with a RejectedExecutionException, indicating that the ExecutorService is saturated. We should recover from this.

Actions #1

Updated by Michael Kay over 5 years ago

  • Status changed from New to Resolved
  • Fix Committed on Branch 9.9 added

Although I'm not 100% confident I know what's going on, I've added code to recover from a RejectedExecutionException by waiting and trying again, a maximum of 10 times, with wait times increasing by successive doubling from 1ms to 1s. Patch to MultithreadedContextMappingIterator.

Actions #2

Updated by O'Neil Delpratt about 5 years ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 9.9.1.1 added

Bug fix applied to the Saxon 9.9.1.1 maintenance release.

Actions #3

Updated by O'Neil Delpratt about 5 years ago

  • Status changed from Resolved to Closed
Actions #4

Updated by Michael Kay about 5 years ago

  • Status changed from Closed to In Progress

I'm going to re-open this because I'm not convinced the current patch is a complete solution. Running the XX compiler in multi-threaded mode, I've seen this error occur even after applying the patch.

Actions #5

Updated by Michael Kay about 5 years ago

  • Status changed from In Progress to Closed
  • Applies to branch trunk added
  • Fix Committed on Branch trunk added

I have not been able to reproduce the problem, so I am closing with no further action.

Note, for future reference however: the patch in MultithreadedContextMappingIterator may also be needed in other places such as MultithreadedItemMappingIterator. Note also that for xsl:result-document, we deal with the RejectedExecution problem a different way: rather than catching the exception, the code in ThreadManagerEE.java does

            if (executorService instanceof ThreadPoolExecutor) {
                ((ThreadPoolExecutor) executorService).setRejectedExecutionHandler(
                        new ThreadPoolExecutor.CallerRunsPolicy());
            }

Please register to edit this issue

Also available in: Atom PDF