Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-1971

Process Engine Database Deadlock on conflicting flush ordering

XMLWordPrintable

      It is possible to construct situations where the process engine flushes its UPDATEs or DELETEs in an order which may lead to deadlocks.

      See Attached Diagram:
      Assume

      • Thread 1 executes the async service task
      • Thread 2 executes the interrupting message receive
        The commands overlap and execute the flush concurrently.

      Flush by Thread 1:

      • UPDATE Execution
      • DELETE Job

      Flush by Thread 2:

      • ...
      • DELETE Job
      • DELETE Execution
      • ...

      At Runtime it may come to an unfortunate interleaving of the statement execution. Consider:

      • Thread 1: UPDATE Execution --> execution locked by T1
      • Thread 2: DELETE Job (Async) --> job locked by T2
      • Thread 1: DELETE Job (Async) --> Blocked since job is locked by T2
      • Thread 2: DELETE Execution --> Blocked since execution is locked by T1

      This leads to a deadlock where T1 waits on T2 and T2 waits on T1.

      Expected behavior would be that the statements are ordered differently and one of the transactions fails with an Optimistic Locking Exception.

        This is the controller panel for Smart Panels app

              meyer Daniel Meyer
              meyer Daniel Meyer
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: