Uploaded image for project: 'Red Hat Process Automation Manager'
  1. Red Hat Process Automation Manager
  2. RHPAM-103

ProcessInstance is not correctly persisted when loaded with readOnly = true early in the same transaction

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.0.0.GA
    • 6.x.x
    • jBPM Core

      With conditions below:

      • Parent/Sub process
      • Tx1
        • Start a parent process instance
        • Sub process is started by CallActivity
        • Reached to a Human Task in the sub process. Tx Committed
      • Tx2
        • Load the parent process with getProcessInstance(parentProcessInstanceId, true) // readOnly = true
        • Complete the Task in the sub process
        • Sub process is completed
        • Parent process instance is resumed
        • Reached to a Human Task in the parent process. Tx Committed

      Parent ProcessInstance is not correctly persisted at the last step. For example, process variable is not updated.

      Analysis
      By debugging, I found that:

      • If you load a process instance with readOnly = true for the first time in the transaction, it will be stored in JPAProcessInstanceManager.processInstances
      • Then, if the same process instance is loaded with readOnly = false (e.g. a parent process instance is signaled on sub process completion), JPAProcessInstanceManager.getProcessInstance() will find the processInstance from "processInstances" cache.
      • processInstance.isPersisted() is false at that moment. So TransactionManagerHelper.addToUpdatableSet() is not called

      https://github.com/kiegroup/jbpm/blob/6.5.x/jbpm-persistence-jpa/src/main/java/org/jbpm/persistence/processinstance/JPAProcessInstanceManager.java#L111-L127

      • So the process instance is not listed in "toBeUpdated" in TriggerUpdateTransactionSynchronization.beforeCompletion() so ProcessInstanceInfo.transform() is not called.

      https://github.com/kiegroup/drools/blob/6.5.x/drools-persistence-jpa/src/main/java/org/drools/persistence/TriggerUpdateTransactionSynchronization.java#L36

              swiderski.maciej Maciej Swiderski (Inactive)
              rhn-support-tkobayas Toshiya Kobayashi
              Marian Macik Marian Macik
              Marian Macik Marian Macik
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: