Velocity
  1. Velocity
  2. VELOCITY-556

Another concurrency issue with macros

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.6
    • Component/s: Engine
    • Labels:
      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

        Activity

        Dima Tkach created issue -
        Hide
        Will Glass-Husain added a comment -

        Thanks for catching this. Seems similar to VELOCITY-536 too.

        I'll try to do a visual inspection of the various nodes and see if this occurs elsewhere.

        Show
        Will Glass-Husain added a comment - Thanks for catching this. Seems similar to VELOCITY-536 too. I'll try to do a visual inspection of the various nodes and see if this occurs elsewhere.
        Will Glass-Husain made changes -
        Field Original Value New Value
        Fix Version/s 1.6 [ 12310290 ]
        Hide
        Will Glass-Husain added a comment -

        patch applied - thanks!

        Show
        Will Glass-Husain added a comment - patch applied - thanks!
        Will Glass-Husain made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Mark Thomas made changes -
        Workflow jira [ 12406722 ] Default workflow, editable Closed status [ 12551264 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551264 ] jira [ 12552183 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Dima Tkach
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development