Concurrency issue while using <xsl:key> Element with shared template object
---------------------------------------------------------------------------

                 Key: XALANJ-2522
                 URL: https://issues.apache.org/jira/browse/XALANJ-2522
             Project: XalanJ2
          Issue Type: Bug
      Security Level: No security risk; visible to anyone (Ordinary problems in 
Xalan projects.  Anybody can view the issue.)
          Components: Xalan
    Affects Versions: 2.7.1
            Reporter: Michal Majcherski


There is concurrency problem while using <xsl:key> Element with shared template 
object.

org.apache.xalan.templates.StylesheetRoot.m_keyDecls field which is shared for 
all transformations of the same compiled XSL (held in impl. of 
javax.xml.transform.Templates object) is implemented as java.util.Vector (which 
is synchronized) what results in large synchronization times.
This has large impact on concurrent XSL transformation process with shared 
compiled XSLs.

I run through lots of own tests of this issue and I saw that:
- transformation times were greatly increased, f.ex. from ~168ms even to 
57684ms (!)
- threads that run long spent most of the time in Monitor state 
(synchronization locks)
- CPU and memory were NOT greatly consumed (this is very important condition to 
run mentioned tests)


I made an attempt to fix this issue by cloning m_keyDecls object on 
getKeysComposed() method:

org.apache.xalan.templates.StylesheetRoot.java

  public Vector getKeysComposed()
  {
-    return m_keyDecls;
+    return (Vector) m_keyDecls.clone();
  }

I'm not very familiar with Xalan code so I'm not sure if this was the best 
place to make a change, but this modification resulted in huge performance hit 
- see attached full results.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscr...@xml.apache.org
For additional commands, e-mail: xalan-dev-h...@xml.apache.org

Reply via email to