Velocity
  1. Velocity
  2. VELOCITY-536

Velocity Engine throws NullPointer Exception when two people click on the same page at the same time for the first time

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.6
    • Component/s: Engine
    • Labels:
      None

      Description

      Multi-thread concurrency issue

      During our concurrency testing, we observed NullPointer exceptions being thrown when two people hit the same page at the same time for the first time. Upon further investigation, it turns out that we need to synchronize the init method on ASTDirective, ASTSetDirective, and render method on ASTSetDirective, and VelocimacroProxy.

      Basically, the problem is introduced as the following; when two threads attempts to parse and render the same template at the same time. Thread1 finishes parsing first and proceeds to the render method call, while thread 2 is still busy parsing and will overwrite the existing parse tree that is being used by thread 1 for rendering purpose. Thus under certainly condition a NullPointer exception will be thrown.

      1. VelocimacroProxy.java
        14 kB
        Lei Gu
      2. ASTSetDirective.java
        7 kB
        Lei Gu
      3. ASTDirective.java
        7 kB
        Lei Gu
      4. 536-patch.txt
        7 kB
        Lei Gu

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Lei Gu
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development