Velocity
  1. Velocity
  2. VELOCITY-776

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

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.6.4
    • Fix Version/s: None
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      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.

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

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Simon Kitching
            • Votes:
              3 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Development