Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-556

Another concurrency issue with macros

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.5
    • 1.6
    • Engine
    • None

    Description

      The symptom is similar to
      https://issues.apache.org/jira/browse/VELOCITY-514 and
      https://issues.apache.org/jira/browse/VELOCITY-24

      • the 'Null AST' errors show up in the logs under concurrency.
        The issue is different however. First, unlike those two, this one only happens when the macro caching is ON (at least, I was never able to reproduce it with the cache off), and second, the issue only appears when there is a macro call from inside a macro. Like this:
        #macro A() A #end
        #macro AB() #A()B#end

      I have debugged this problem, and came up with this fix. I replaced Velocimacro.class file in velocity-1.5.jar with the one I compiled with my fix, and have been running it in production evironment for a while. It does indeed seem to have fixed the problem.
      Please feel free to use this fix if you like it.

      — org/apache/velocity/runtime/directive/VelocimacroProxy.orig 2007-06-08 19:21:19.000000000 -0400
      +++ org/apache/velocity/runtime/directive/VelocimacroProxy.java 2007-06-08 19:22:10.000000000 -0400
      @@ -164,11 +164,14 @@

      if (nodeTree != null)
      {
      + synchronized (this)
      + {
      if ( !init )

      { nodeTree.init( context, rsvc); init = true; }

      + }

      /*

      • wrap the current context and add the VMProxyArg objects

      – Dima

      Attachments

        Activity

          People

            Unassigned Unassigned
            dimatkach Dima Tkach
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: