Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-3416

LoggingInstance concurrency issue

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jBPM 3.2.12
    • jBPM 3.2.11
    • Runtime Engine
    • None

      If 2 threads concurrently call Token#signal() and ContextThread#setVariable() on the same process instance, the following Exceptions may be thrown.

      java.lang.ArrayIndexOutOfBoundsException: -1
              at java.util.ArrayList.get(Unknown Source)
              at org.jbpm.logging.exe.LoggingInstance.addLog(LoggingInstance.java:65)
              at org.jbpm.graph.exe.Token.addLog(Token.java:380)
              at org.jbpm.context.exe.variableinstance.StringInstance.setObject(StringInstance.java:42)
              at org.jbpm.context.exe.VariableInstance.setValue(VariableInstance.java:122)
              at org.jbpm.context.exe.VariableInstance.create(VariableInstance.java:69)
              at org.jbpm.context.exe.VariableContainer.setVariableLocally(VariableContainer.java:171)
              at org.jbpm.context.exe.VariableContainer.setVariable(VariableContainer.java:50)
              at org.jbpm.context.exe.ContextInstance.setVariable(ContextInstance.java:205)
              at org.jbpm.context.exe.ContextInstance.setVariable(ContextInstance.java:196)
              at sample.JbpmTest$ContextThread.run(JbpmTest.java:141)
      
      java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
              at java.util.ArrayList.RangeCheck(Unknown Source)
              at java.util.ArrayList.get(Unknown Source)
              at org.jbpm.logging.exe.LoggingInstance.addLog(LoggingInstance.java:65)
              at org.jbpm.graph.exe.Token.addLog(Token.java:380)
              at org.jbpm.context.exe.variableinstance.StringInstance.setObject(StringInstance.java:42)
              at org.jbpm.context.exe.VariableInstance.setValue(VariableInstance.java:122)
              at org.jbpm.context.exe.VariableInstance.create(VariableInstance.java:69)
              at org.jbpm.context.exe.VariableContainer.setVariableLocally(VariableContainer.java:171)
              at org.jbpm.context.exe.VariableContainer.setVariable(VariableContainer.java:50)
              at org.jbpm.context.exe.ContextInstance.setVariable(ContextInstance.java:205)
              at org.jbpm.context.exe.ContextInstance.setVariable(ContextInstance.java:196)
              at sample.JbpmTest$ContextThread.run(JbpmTest.java:141)
      
      java.lang.NullPointerException
              at org.jbpm.logging.exe.LoggingInstance.addLog(LoggingInstance.java:66)
              at org.jbpm.graph.exe.Token.addLog(Token.java:380)
              at org.jbpm.context.exe.VariableInstance.create(VariableInstance.java:66)
              at org.jbpm.context.exe.VariableContainer.setVariableLocally(VariableContainer.java:171)
              at org.jbpm.context.exe.VariableContainer.setVariable(VariableContainer.java:50)
              at org.jbpm.context.exe.ContextInstance.setVariable(ContextInstance.java:205)
              at org.jbpm.context.exe.ContextInstance.setVariable(ContextInstance.java:196)
              at sample.JbpmTest$ContextThread.run(JbpmTest.java:141)
      

      It's about the atomicity of org.jbpm.logging.exe.LoggingInstance.compositeLogStack operation.

      Attached a proposal patch.

            marco.rietveld Marco Rietveld (Inactive)
            rhn-support-tkobayas Toshiya Kobayashi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: