Project

Profile

Help

Bug #2433

closed

Multi-threaded xsl:for-each

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

Status:
Closed
Priority:
Normal
Assignee:
Category:
Internals
Sprint/Milestone:
Start date:
2015-08-04
Due date:
% Done:

100%

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

Description

A client has reported that on occasions (once every few weeks) use of xsl:for-each with saxon:threads="N" will hang (that is, no threads make progress). The VM dump does not indicate any deadlock, so it appears to be some kind of livelock. We haven't succeeded in isolating a coding error that would account for the behaviour, but we have decided to retrofit an improved design for the feature from the 9.7 code base. The 9.6 implementation uses Saxon's Conduit class, which is a very basic implementation of a shared producer/consumer queue synchronized using Java primitives. The 9.7 implementation replaces this with a LinkedBlockingQueue from the Java concurrency framework.

We've also identified some potential for concurrency problems when a multi-threaded xsl:for-each loop does lazy evaluation of variables declared outside the loop: see http://dev.saxonica.com/blog/mike/2015/06/lazy-evaluation.html. To reduce the possibility of such problems, we decided to evaluate such variables eagerly. The same code also fixes a problem with try/catch, in that lazy evaluation of variables within a try/catch can cause dynamic errors to be caught that should not be.

We are therefore committing two patches to the 9.6 code-base: a rewrite of the multithreaded execution for xsl:for-each with a saxon:threads attribute, and a change to the execution plan for local variables so that eager evaluation is used if any reference to the variable appears within (a) a multi-threaded xsl:for-each, (b) a try/catch block, or (c) a multi-threaded xsl:result-document instruction (and where the declaration of the variable appears outside that construct).

Actions #1

Updated by O'Neil Delpratt over 9 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in version set to 9.6.0.7

Bug fix applied in the Saxon 9.6.0.7 maintenance release.

Actions #2

Updated by O'Neil Delpratt about 9 years ago

  • Applies to branch 9.6 added
  • Fix Committed on Branch 9.6 added
  • Fixed in Maintenance Release 9.6.0.7 added
Actions #3

Updated by O'Neil Delpratt about 9 years ago

  • Sprint/Milestone set to 9.6.0.7

Please register to edit this issue

Also available in: Atom PDF