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

Creation of incidents is not null safe

    Details

      Description

      The default behavior in the engine is that whenever a job fails, the retry of the failing job is decremented. When the job retry is set to 0, then a new incident is created. The decrement of the job retry and creation of the incident happens in a transaction listener which is registered on the transaction state ROLLED_BACK.
      If the creation of the incident fails, the transaction is also rolled back and the job retry property stays by 1. This could lead to a kind of a loop, so that the execution of job fails and the job retries cannot be decremented in a separate transaction because of the failing incident creation.

      This can happen for example here: https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/IncidentEntity.java#L140
      For some reason the executionId is not null, but the respective fetched execution is null, so that newIncident.setExecution(execution) will fail with a NullPointerException.

      AT:

      • make the creation of an incident null safe

        Issue Links

          Activity

          Hide
          roman.smirnov Smirnov Roman added a comment -

          Unfortunately it is not clear how the inconsistent state can occur, that an incident references a non existing execution. For that reason, I decided not to write a test case for making the creation of incidents null safe.

          Show
          roman.smirnov Smirnov Roman added a comment - Unfortunately it is not clear how the inconsistent state can occur, that an incident references a non existing execution. For that reason, I decided not to write a test case for making the creation of incidents null safe.

            People

            • Assignee:
              Unassigned
              Reporter:
              roman.smirnov Smirnov Roman
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development