Another concurrency issue with macros
-------------------------------------

                 Key: VELOCITY-556
                 URL: https://issues.apache.org/jira/browse/VELOCITY-556
             Project: Velocity
          Issue Type: Bug
          Components: Engine
    Affects Versions: 1.5
            Reporter: Dima Tkach


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

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to