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

Duplicate timer execution with long running timers and async nodes

    XMLWordPrintable

Details

    • False
    • None
    • False
    • -
    • Hide

      Run the attached reproducer, it will start an instance of the process waiting in a Human Task. Once the boundary timer attached to the HT fires (30m), the following script task gets executed twice instead of one time:

      10:55:16,618 INFO  [stdout] (Thread-1 (ActiveMQ-client-global-threads)) STARTING PROCESS 21
      11:25:16,927 INFO  [stdout] (Thread-3 (ActiveMQ-client-global-threads)) Terminating Pretimer1
      11:25:18,986 INFO  [stdout] (Thread-3 (ActiveMQ-client-global-threads)) Terminating Pretimer1
      
      Show
      Run the attached reproducer, it will start an instance of the process waiting in a Human Task. Once the boundary timer attached to the HT fires (30m), the following script task gets executed twice instead of one time: 10:55:16,618 INFO [stdout] (Thread-1 (ActiveMQ-client-global-threads)) STARTING PROCESS 21 11:25:16,927 INFO [stdout] (Thread-3 (ActiveMQ-client-global-threads)) Terminating Pretimer1 11:25:18,986 INFO [stdout] (Thread-3 (ActiveMQ-client-global-threads)) Terminating Pretimer1
    • ---
    • ---

    Description

      In a process containing a task with a boundary timer, we can see that the timer gets executed twice in the following setup:

      1. Environment entry Async=true
      2. Timer PT30M (shorter timers don't show issues)

      Note that this can be reproduced on a single kie-server node.

      When the EJB timer fires, the jobHandles are added to the GlobalTimerService map here:
      https://github.com/kiegroup/jbpm/blob/main/jbpm-flow/src/main/java/org/jbpm/process/core/timer/impl/GlobalTimerService.java#L120

      The same thread is then responsible for removing the timer from the session. However, with long running timers the following logic is broken:
      https://github.com/kiegroup/jbpm/blob/main/jbpm-flow/src/main/java/org/jbpm/process/core/timer/impl/GlobalTimerService.java#L155

      This leads to the jobHandle not getting removed from the map before the session gets persisted. When the async execution happens and the session is deserialized, the timer gets recreated (a new EJB timer will be created). This new timer then leads to the second execution of the node.

       

      Attachments

        Activity

          People

            ftirados Francisco Javier Tirado Sarti
            martinweiler Martin Weiler
            Gonzalo Muñoz Fernández Gonzalo Muñoz Fernández
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: