You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Etienne Massip (JIRA)" <de...@velocity.apache.org> on 2007/10/10 12:00:52 UTC

[jira] Created: (VELOCITY-566) EmptyStackException when rendering macros simultaneously

EmptyStackException when rendering macros simultaneously
--------------------------------------------------------

                 Key: VELOCITY-566
                 URL: https://issues.apache.org/jira/browse/VELOCITY-566
             Project: Velocity
          Issue Type: Bug
          Components: Engine
    Affects Versions: 1.6
            Reporter: Etienne Massip
             Fix For: 1.6
         Attachments: emptyStackExceptionMacrosVTL.patch

When two threads are running VelocimacroFactory.startRenderingMacro() simultaneously (same template), both check that templateMap is empty, then both create a new stack, then the second thread put it in templateMap, replacing the one added by the first thread.

At this time we got a stack which size == 1 instead of 2.

Then both threads endProcessingMacros(), both get stack from templateMap and check that its size is > 0, first one empty stack then second pop() macro and gets an EmptyStackException.

behavior was introduced by improvement VELOCITY-297.

patch is joined, synchronize(templateMap) in VelocimacroFactory.startRenderingMacro().

-- 
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-566) EmptyStackException when rendering macros simultaneously

Posted by "Etienne Massip (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-566?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533768 ] 

Etienne Massip commented on VELOCITY-566:
-----------------------------------------

I forgot that brace thing, sorry. Yes, "ant test" does work.

Thanks !


> EmptyStackException when rendering macros simultaneously
> --------------------------------------------------------
>
>                 Key: VELOCITY-566
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-566
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6
>            Reporter: Etienne Massip
>             Fix For: 1.6
>
>         Attachments: emptyStackExceptionMacrosVTL.patch
>
>
> When two threads are running VelocimacroFactory.startRenderingMacro() simultaneously (same template), both check that templateMap is empty, then both create a new stack, then the second thread put it in templateMap, replacing the one added by the first thread.
> At this time we got a stack which size == 1 instead of 2.
> Then both threads endProcessingMacros(), both get stack from templateMap and check that its size is > 0, first one empty stack then second pop() macro and gets an EmptyStackException.
> behavior was introduced by improvement VELOCITY-297.
> patch is joined, synchronize(templateMap) in VelocimacroFactory.startRenderingMacro().

-- 
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-566) EmptyStackException when rendering macros simultaneously

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

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

Hi Etienne --

Thanks for contributing!  (and nice catch).  Does "ant test" work?

Also, just a quick note.  Remember when submitting patches in the future to follow the code style guidelines (on our Wiki).  We tend to be irritatingly picky about braces on their own line.  (Makes the code easier to read).  I'll fix them this time.



> EmptyStackException when rendering macros simultaneously
> --------------------------------------------------------
>
>                 Key: VELOCITY-566
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-566
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6
>            Reporter: Etienne Massip
>             Fix For: 1.6
>
>         Attachments: emptyStackExceptionMacrosVTL.patch
>
>
> When two threads are running VelocimacroFactory.startRenderingMacro() simultaneously (same template), both check that templateMap is empty, then both create a new stack, then the second thread put it in templateMap, replacing the one added by the first thread.
> At this time we got a stack which size == 1 instead of 2.
> Then both threads endProcessingMacros(), both get stack from templateMap and check that its size is > 0, first one empty stack then second pop() macro and gets an EmptyStackException.
> behavior was introduced by improvement VELOCITY-297.
> patch is joined, synchronize(templateMap) in VelocimacroFactory.startRenderingMacro().

-- 
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-566) EmptyStackException when rendering macros simultaneously

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

Etienne Massip updated VELOCITY-566:
------------------------------------

    Attachment: emptyStackExceptionMacrosVTL.patch

> EmptyStackException when rendering macros simultaneously
> --------------------------------------------------------
>
>                 Key: VELOCITY-566
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-566
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6
>            Reporter: Etienne Massip
>             Fix For: 1.6
>
>         Attachments: emptyStackExceptionMacrosVTL.patch
>
>
> When two threads are running VelocimacroFactory.startRenderingMacro() simultaneously (same template), both check that templateMap is empty, then both create a new stack, then the second thread put it in templateMap, replacing the one added by the first thread.
> At this time we got a stack which size == 1 instead of 2.
> Then both threads endProcessingMacros(), both get stack from templateMap and check that its size is > 0, first one empty stack then second pop() macro and gets an EmptyStackException.
> behavior was introduced by improvement VELOCITY-297.
> patch is joined, synchronize(templateMap) in VelocimacroFactory.startRenderingMacro().

-- 
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] Closed: (VELOCITY-566) EmptyStackException when rendering macros simultaneously

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

Etienne Massip closed VELOCITY-566.
-----------------------------------


> EmptyStackException when rendering macros simultaneously
> --------------------------------------------------------
>
>                 Key: VELOCITY-566
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-566
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6
>            Reporter: Etienne Massip
>             Fix For: 1.6
>
>         Attachments: emptyStackExceptionMacrosVTL.patch
>
>
> When two threads are running VelocimacroFactory.startRenderingMacro() simultaneously (same template), both check that templateMap is empty, then both create a new stack, then the second thread put it in templateMap, replacing the one added by the first thread.
> At this time we got a stack which size == 1 instead of 2.
> Then both threads endProcessingMacros(), both get stack from templateMap and check that its size is > 0, first one empty stack then second pop() macro and gets an EmptyStackException.
> behavior was introduced by improvement VELOCITY-297.
> patch is joined, synchronize(templateMap) in VelocimacroFactory.startRenderingMacro().

-- 
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-566) EmptyStackException when rendering macros simultaneously

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

Will Glass-Husain resolved VELOCITY-566.
----------------------------------------

    Resolution: Fixed

patch committed - thanks!

> EmptyStackException when rendering macros simultaneously
> --------------------------------------------------------
>
>                 Key: VELOCITY-566
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-566
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6
>            Reporter: Etienne Massip
>             Fix For: 1.6
>
>         Attachments: emptyStackExceptionMacrosVTL.patch
>
>
> When two threads are running VelocimacroFactory.startRenderingMacro() simultaneously (same template), both check that templateMap is empty, then both create a new stack, then the second thread put it in templateMap, replacing the one added by the first thread.
> At this time we got a stack which size == 1 instead of 2.
> Then both threads endProcessingMacros(), both get stack from templateMap and check that its size is > 0, first one empty stack then second pop() macro and gets an EmptyStackException.
> behavior was introduced by improvement VELOCITY-297.
> patch is joined, synchronize(templateMap) in VelocimacroFactory.startRenderingMacro().

-- 
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