You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Dima Tkach (JIRA)" <de...@velocity.apache.org> on 2007/06/21 00:04:28 UTC

[jira] Created: (VELOCITY-556) Another concurrency issue with macros

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


[jira] Updated: (VELOCITY-556) Another concurrency issue with macros

Posted by "Will Glass-Husain (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Will Glass-Husain updated VELOCITY-556:
---------------------------------------

    Fix Version/s: 1.6

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


[jira] Resolved: (VELOCITY-556) Another concurrency issue with macros

Posted by "Will Glass-Husain (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Will Glass-Husain resolved VELOCITY-556.
----------------------------------------

    Resolution: Fixed

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


[jira] Commented: (VELOCITY-556) Another concurrency issue with macros

Posted by "Will Glass-Husain (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12522373 ] 

Will Glass-Husain commented on VELOCITY-556:
--------------------------------------------

patch applied - thanks!

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


[jira] Commented: (VELOCITY-556) Another concurrency issue with macros

Posted by "Will Glass-Husain (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506756 ] 

Will Glass-Husain commented on VELOCITY-556:
--------------------------------------------

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.

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