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

"velocimacro.permissions.allow.inline.local.scope" makes VelocityEngine not threadsafe

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.4
    • 2.0
    • Engine
    • None
    • Sun java jdk1.6.0_21, Ubuntu 10.04

    Description

      The attached unit test shows that when "velocimacro.permissions.allow.inline.local.scope" is set to true, and multiple threads use the same VelocityEngine instance then macros sometimes don't get expanded and the #macroname call remains in the output text.

      Notes:

      • running test method "testMultipleEvals" (single threaded case) always succeeds
      • running test method "testMultiThreadMultipleEvals" always fails
      • commenting out the allow.inline.local.scope line makes the multithread test pass (but of course has other side-effects)

      Interestingly, for the multithread case it seems that 1 thread always succeeds and N-1 threads fail.

      Attachments

        1. RenderVelocityTemplateTest.java
          3 kB
          Simon Kitching
        2. RenderVelocityTemplate.java
          0.9 kB
          Simon Kitching

        Issue Links

          Activity

            People

              cbrisson Claude Brisson
              skitching Simon Kitching
              Votes:
              4 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: