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

Async process never ends from time to time

    XMLWordPrintable

Details

    • Bug Report
    • Resolution: Cannot Reproduce
    • L3 - Default
    • None
    • 7.5.0
    • engine
    • None

    Description

      There is the following process: https://raw.githubusercontent.com/camunda/camunda-engine-cassandra/master/src/test/resources/org/camunda/bpm/engine/cassandra/asynch-test.png

      Delegate used here is very fast:

      public class AsynchTestDelegate implements JavaDelegate {
      	  protected static final Logger log = LoggerFactory.getLogger(AsynchTestDelegate.class);
      
      	@Override
      	public void execute(DelegateExecution execution) throws Exception {
      	    log.info("TestDelegate called for execution: "+execution.getCurrentActivityName()+" executed: "+executed);
      //	    Thread.sleep(20);
      	}
      }
      

      And it's randomly happened that process instance never ends. Debugging shown the reason. It's here:

      public class ParallelGatewayActivityBehavior extends GatewayActivityBehavior {
        protected static final BpmnBehaviorLogger LOG = ProcessEngineLogger.BPMN_BEHAVIOR_LOGGER;
        public void execute(ActivityExecution execution) throws Exception {
      
          // Join
          PvmActivity activity = execution.getActivity();
          List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions();
      
          execution.inactivate();
          lockConcurrentRoot(execution);
      
          List<ActivityExecution> joinedExecutions = execution.findInactiveConcurrentExecutions(activity);
          int nbrOfExecutionsToJoin = execution.getActivity().getIncomingTransitions().size();
          int nbrOfExecutionsJoined = joinedExecutions.size();
      
          if (nbrOfExecutionsJoined==nbrOfExecutionsToJoin) {  //HERE!!!!!!!!
      
            // Fork
            LOG.activityActivation(activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
            execution.leaveActivityViaTransitions(outgoingTransitions, joinedExecutions);
      
          } else {
            LOG.noActivityActivation(activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
          }
        }
      }
      

      Line is marked below. Delegate seems to execute too fast that for both parallel activites at the final gateway we see that:

      nbrOfExecutionsToJoin = 2
      nbrOfExecutionsJoined = 1

      Any ideas how to fix?

      P.S. There is quick workaround: just add Thread.sleep() to a delegate code.
      P.P.S. We are working on camunda engine for OrientDB: https://github.com/OrienteerBAP/Orienteer/tree/bpm/orienteer-bpm

      mgm-controller-panel

        This is the controller panel for Smart Panels app

        Attachments

          Activity

            People

              Unassigned Unassigned
              Ilya Ilya Naryzhnyy
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Salesforce