[Deploying Sakai] [Building Sakai] Deadlock in portal/velocity intermittently seen soon after startup

David Adams da1 at vt.edu
Sun Nov 3 03:29:11 PST 2013


Thanks, Bill. This is extremely useful. In fact, I see that the
sakai-velocity-tool library at the source code in ./velocity already
uses 1.6.4. We'll probably roll out this change with our next release
late this month and I'll definitely report back with any new findings.

--
David Adams
Director of Server and Network Operations
Virginia Tech TLOS, Technology-enhanced Learning and Online Strategies


On Sat, Nov 2, 2013 at 9:16 PM, Niebel, William (wdn5e)
<wdn5e at eservices.virginia.edu> wrote:
> Hi, David.
>
> You might remember that University of Virginia also is at Sakai 2.9 under Tomcat behind Apache on each of our individual servers.
> I don't remember us ever seeing the problem you describe.  Other configuration differences may explain why our experience is different.
>
> Our top-level portal pom.xml for Sakai 2.9.1 has Velocity at version 1.6.3    I assume you do too.
> That version uses the non-thread-safe HashMap seen at the top of your stack trace.
>
> You might try the next version 1.6.4 which finesses this for multi-threading.
> (Again, we're at 1.6.3 and not having a problem, so won't bump this ourselves.)
>
> Here's why:
>
> The previous line in your stack trace
> at org.apache.velocity.util.introspection.ClassMap$MethodCache.get(ClassMap.java:249) is source code line
> Object cacheEntry = cache.get(methodKey);
> from http://svn.apache.org/viewvc/velocity/engine/tags/1.6.3/src/java/org/apache/velocity/util/introspection/ClassMap.java?view=markup
>
> MethodCache's instance variable "cache" is defined in the same source code file
> org.apache.velocity.util.introspection.ClassMap:218 as
>  private final Map cache = new HashMap();
>
> So Velocity 1.6.3 hardcodes this Map for single-threading.
>
>
> The equivalent line in the next version 1.6.4
> org.apache.velocity.util.introspection.ClassMap:219 is instead
>  private final Map cache = MapFactory.create(false);
> ( instead from http://svn.apache.org/viewvc/velocity/engine/tags/1.6.4/src/java/org/apache/velocity/util/introspection/ClassMap.java?view=markup )
>
> Following this create() call into same-version
> http://svn.apache.org/viewvc/velocity/engine/tags/1.6.4/src/java/org/apache/velocity/util/MapFactory.java?view=markup
> org.apache.velocity.util.ClassMapFactory:67 create(...) method sets up some defaults and then calls
> org.apache.velocity.util.ClassMapFactory:88 create(...) method with fuller signature, which returns a Map implementation appropriate for the level of concurrency and Java version
>
>
> 1.6.3 has similar MapFactory code, but it's not used in its line 218.  Also, I didn't look for Apache issue tracking which would explain the source code change.
>
>
> Maybe ClassMap is a singleton and shared among threads, and so it matters how this is implemented.  However that is, it does look like bumping the Velocity version might help with this.
>
> We certainly would like to know if this works out or any other success you have.  Good luck with it.
>
> Bill Niebel
> University of Virginia
>


More information about the production mailing list