cancel
Showing results for 
Search instead for 
Did you mean: 

Context lost after 30 minutes inactivity

quirino_brizi
Champ in-the-making
Champ in-the-making
Hi All,

We are facing an odd issue when running Activiti version 5.20, the issue is that using a simple BPMN with an Intemediate Catching Event Timer and a Service Task which uses expression we are getting PropertyUnresolvedException after about 30 minutes of inactivity on Activiti.
If the BPMN is triggered at intervals that are less than 30 minutes all works fine.
We have noticed as well that when the job is retried, using the default FailedJobCommandFactory, the execution of the service task is successful.

Our set-up is as following:

We are using Activiti 5.20 integrated with Spring Boot version 1.3.5-RELEASE.

The BPMN we are using is as below:

<code>
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef">
  <process id="activitiTimerIssue" name="Activi Timer Issue" isExecutable="true">
    <sequenceFlow id="sid-604F4F58-7E3E-4500-99F2-AFB13BE170BF" sourceRef="sid-B502AE80-0F09-4630-9461-6DA743C5CE0C" targetRef="sid-3F59B8FB-4EBD-45E5-8922-37F352B0DC43"></sequenceFlow>
    <endEvent id="sid-3F59B8FB-4EBD-45E5-8922-37F352B0DC43"></endEvent>
    <serviceTask id="sid-B502AE80-0F09-4630-9461-6DA743C5CE0C" name="get resource info" activiti:expression="#{resources.getInfo(&quot;site&quot;, inputs.enterpriseId)}" activiti:resultVariableName="resourceProperties"></serviceTask>
    <intermediateCatchEvent id="timer2" name="Intermediate Timer">
      <timerEventDefinition>
        <timeDuration>PT10S</timeDuration>
      </timerEventDefinition>
    </intermediateCatchEvent>
    <sequenceFlow id="sid-14F9F523-8C64-42AA-833F-178292E06717" sourceRef="timer2" targetRef="sid-B502AE80-0F09-4630-9461-6DA743C5CE0C"></sequenceFlow>
    <startEvent id="start1" name="Start"></startEvent>
    <sequenceFlow id="sid-8D2B8BFF-DD94-4594-8206-973CD112CE4B" sourceRef="start1" targetRef="timer2"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_activitiTimerIssue">
    <bpmndi:BPMNPlane bpmnElement="activitiTimerIssue" id="BPMNPlane_activitiTimerIssue">
      <bpmndi:BPMNShape bpmnElement="sid-3F59B8FB-4EBD-45E5-8922-37F352B0DC43" id="BPMNShape_sid-3F59B8FB-4EBD-45E5-8922-37F352B0DC43">
        <omgdc:Bounds height="28.0" width="28.0" x="510.0" y="226.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-B502AE80-0F09-4630-9461-6DA743C5CE0C" id="BPMNShape_sid-B502AE80-0F09-4630-9461-6DA743C5CE0C">
        <omgdc:Bounds height="80.0" width="100.0" x="285.0" y="200.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="timer2" id="BPMNShape_timer2">
        <omgdc:Bounds height="31.0" width="31.0" x="195.0" y="120.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="start1" id="BPMNShape_start1">
        <omgdc:Bounds height="30.0" width="30.0" x="102.0" y="120.5"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-8D2B8BFF-DD94-4594-8206-973CD112CE4B" id="BPMNEdge_sid-8D2B8BFF-DD94-4594-8206-973CD112CE4B">
        <omgdi:waypoint x="132.0" y="135.5"></omgdi:waypoint>
        <omgdi:waypoint x="195.0" y="135.5"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-14F9F523-8C64-42AA-833F-178292E06717" id="BPMNEdge_sid-14F9F523-8C64-42AA-833F-178292E06717">
        <omgdi:waypoint x="223.25906469001268" y="146.28179619162353"></omgdi:waypoint>
        <omgdi:waypoint x="287.3076923076923" y="200.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-604F4F58-7E3E-4500-99F2-AFB13BE170BF" id="BPMNEdge_sid-604F4F58-7E3E-4500-99F2-AFB13BE170BF">
        <omgdi:waypoint x="385.0" y="240.0"></omgdi:waypoint>
        <omgdi:waypoint x="510.0" y="240.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
<code>

Thanks in advance for your help,

~Q
11 REPLIES 11

quirino_brizi
Champ in-the-making
Champ in-the-making
Hi,

Looking a bit more closely the ProcessEngineConfigurationImpl I can see the following code:

<java>
// job executor /////////////////////////////////////////////////////////////
 
  protected void initJobExecutor() {
    if (isAsyncExecutorEnabled() == false) {
      if (jobExecutor == null) {
        jobExecutor = new DefaultJobExecutor();
      }
 
      jobExecutor.setClockReader(this.clock);
 
      jobExecutor.setCommandExecutor(commandExecutor);
      jobExecutor.setAutoActivate(jobExecutorActivate);
     
      if (jobExecutor.getRejectedJobsHandler() == null) {
        if(customRejectedJobsHandler != null) {
          jobExecutor.setRejectedJobsHandler(customRejectedJobsHandler);
        } else {
          jobExecutor.setRejectedJobsHandler(new CallerRunsRejectedJobsHandler());
        }
      }
    }
  }
 
  // async executor /////////////////////////////////////////////////////////////
 
  protected void initAsyncExecutor() {
    if (isAsyncExecutorEnabled()) {
      if (asyncExecutor == null) {
        DefaultAsyncJobExecutor defaultAsyncExecutor = new DefaultAsyncJobExecutor();
       
        // Thread pool config
        defaultAsyncExecutor.setCorePoolSize(asyncExecutorCorePoolSize);
        defaultAsyncExecutor.setMaxPoolSize(asyncExecutorMaxPoolSize);
        defaultAsyncExecutor.setKeepAliveTime(asyncExecutorThreadKeepAliveTime);
       
        // Threadpool queue
        if (asyncExecutorThreadPoolQueue != null) {
         defaultAsyncExecutor.setThreadPoolQueue(asyncExecutorThreadPoolQueue);
        }
        defaultAsyncExecutor.setQueueSize(asyncExecutorThreadPoolQueueSize);
       
        // Acquisition wait time
        defaultAsyncExecutor.setDefaultTimerJobAcquireWaitTimeInMillis(asyncExecutorDefaultTimerJobAcquireWaitTime);
        defaultAsyncExecutor.setDefaultAsyncJobAcquireWaitTimeInMillis(asyncExecutorDefaultAsyncJobAcquireWaitTime);
       
        // Queue full wait time
        defaultAsyncExecutor.setDefaultQueueSizeFullWaitTimeInMillis(asyncExecutorDefaultQueueSizeFullWaitTime);
       
        // Job locking
        defaultAsyncExecutor.setTimerLockTimeInMillis(asyncExecutorTimerLockTimeInMillis);
        defaultAsyncExecutor.setAsyncJobLockTimeInMillis(asyncExecutorAsyncJobLockTimeInMillis);
        if (asyncExecutorLockOwner != null) {
         defaultAsyncExecutor.setLockOwner(asyncExecutorLockOwner);
        }
       
        // Retry
        defaultAsyncExecutor.setRetryWaitTimeInMillis(asyncExecutorLockRetryWaitTimeInMillis);
       
        // Shutdown
        defaultAsyncExecutor.setSecondsToWaitOnShutdown(asyncExecutorSecondsToWaitOnShutdown);
       
        asyncExecutor = defaultAsyncExecutor;
      }
 
      asyncExecutor.setCommandExecutor(commandExecutor);
      asyncExecutor.setAutoActivate(asyncExecutorActivate);
    }
  }
<java>

Which at least on my opinion does not take into consideration the jobExecutorActivate property and activate at least one between AsyncJobExecutor and JobExecutor.

Considering the above how can I completely disable job execution? if I extend SpringProcessEngineConfiguration to completely disable job executor will this create problems in other areas of the application?

Thanks,
~Q

quirino_brizi
Champ in-the-making
Champ in-the-making
Hi,

In order to fix the problem I extended SpringProcessEngineConfiguration and override the initJobExecutor method as below:

<java>
@Override
    protected void initJobExecutor() {
        if (isJobExecutorActivate()) {
            super.initJobExecutor();
        }
    }
</java>

It would be nice to have the above conceptual implementation so that the contract for jobExecutorActivate property is respected or if Activiti strategy is to have at least one executor enabled to make this clear on the documentation and remove/deprecate the above mentioned property.

Thanks for your help.
~Q