Uploaded image for project: 'JBoss BPMS Platform'
  1. JBoss BPMS Platform
  2. RHBPMS-4967

[GSS] (6.4.z) ProcessInstance is not correctly persisted when loaded with readOnly = true early in the same transaction

    Details

      Description

      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

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  swiderski.maciej Maciej Swiderski
                  Reporter:
                  tkobayashi Toshiya Kobayashi
                  Tester:
                  Marian Macik
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: