You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Michal Majcherski (JIRA)" <xa...@xml.apache.org> on 2010/10/01 16:20:32 UTC

[jira] Created: (XALANJ-2522) Concurrency issue while using Element with shared template object

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-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org