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
As additional note this is the exception we are facing:

<code>
org.activiti.engine.ActivitiException: Unknown property used in expression: #{resources.getInfo("https://ts.accenture.com/sites/PCSC_Global/RM/", inputs.enterpriseId)}
at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:53)
at org.activiti.engine.impl.bpmn.behavior.ServiceTaskExpressionActivityBehavior.execute(ServiceTaskExpressionActivityBehavior.java:68)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:60)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52)
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:49)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake.execute(AtomicOperationTransitionNotifyListenerTake.java:80)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:116)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEnd.java:35)
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:453)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:431)
at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:140)
at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:66)
at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44)
at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:47)
at org.activiti.engine.impl.bpmn.behavior.IntermediateCatchEventActivityBehavior.signal(IntermediateCatchEventActivityBehavior.java:27)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.signal(ExecutionEntity.java:410)
at org.activiti.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler.execute(TimerCatchIntermediateEventJobHandler.java:58)
at org.activiti.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:85)
at org.activiti.engine.impl.persistence.entity.TimerEntity.execute(TimerEntity.java:95)
at org.activiti.engine.impl.cmd.ExecuteAsyncJobCmd.execute(ExecuteAsyncJobCmd.java:52)
at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.executeJob(ExecuteAsyncRunnable.java:95)
at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:50)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'resources'
at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
at org.activiti.engine.impl.juel.AstMethod.invoke(AstMethod.java:90)
at org.activiti.engine.impl.juel.AstMethod.eval(AstMethod.java:86)
at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)
at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)
at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
at org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)
at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:50)
… 60 more
<code>

Thanks,
~Q

trademak
Star Contributor
Star Contributor
Hi,

Is this always reproducible? There's no special logic happening after a certain amount of minutes.

Best regards,

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

Yes this is always reproducible. I see that there is no special logic I followed the code till AstIdentifier#eval and down to it. I can see that Sprint application context is used as a resolver.

What I am testing now, and look good on preliminary tests, is to:

* Disable Async Job Executor and use legacy Job Executor
* Define the bean that I use on the expression with scope prototype.

I'll update on my findings.

Thanks,
~Q

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

More tests shows that the test on my previous post does not resolve the issues and that the issue is still same. The false positive we where facing at the start was related to redeployment.

As additional information, we have the same BPMN defined using a JavaDelegate and we cannot verify the same behaviour unfortunately we require expressions so use JavaDelegate is the latest option.

Thanks,
~Q

trademak
Star Contributor
Star Contributor
Hi,

We are using expression a lot in our unit tests and application code, so this should work fine.
Are you sure the resources bean is available for Activiti?
Can you share a unit test project showing the issue?

Best regards,

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

The problem here is not related to expressions they work fine. Between production and test we have about 40 BPMN of different complexity using expressions and all work fine.

This is a specific case the problem arises only when an expression is used after an intermediate timer, we tests with start timer and it works fine, the BPMN is not started for 30 minutes or more, and the expression references a bean from the spring context.

Due to the time factor all the tests we have work perfectly as: if the context is just started or started for less than 30 minutes the problem does not appear.

Thanks,
~Q

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

Found the bottom line problem. We have clustered activiti and among the cluster we have activiti-explores that we use as an observer only so we do not deploy on activiti-explorer any of our custom bean hence the failure which make sense. Still I don't understand the 30 minutes cadence but this is another point.

What intrigues me is that in order to avoid activiti-explorer from scheduling jobs we disabled the job executor on activiti-custom-context.xml (https://forums.activiti.org/content/clustering) but activiti-explorer is still processing events, is there something I am missing or not configuring correctly?

<code>
root@cfabdb4f471b:/# cat /opt/tomcat/webapps/activiti-explorer/WEB-INF/classes/activiti-custom-context.xml        
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
  xmlns:jee="http://www.springframework.org/schema/jee" xmlns:aop="http://www.springframework.org/schema/aop"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
      
  <!– <bean id="dbProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="classpath:db.properties" />
    <property name="ignoreUnresolvablePlaceholders" value="true" />
  </bean>
   
  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="${jdbc.driver}" />
    <property name="url" value="${jdbc.url}" />
    <property name="username" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
    <property name="defaultAutoCommit" value="false" />
  </bean>

  <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
   <property name="dataSource" ref="dataSource" />
  </bean>
 
  <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
   <property name="dataSource" ref="dataSource" />
   <property name="transactionManager" ref="transactionManager" />
   <property name="databaseSchemaUpdate" value="true" />
   <property name="jobExecutorActivate" value="false" />
    <property name="enableDatabaseEventLogging" value="true" />
    <property name="customFormTypes">
      <list>
        <bean class="org.activiti.explorer.form.UserFormType"/>
        <bean class="org.activiti.explorer.form.ProcessDefinitionFormType"/>
        <bean class="org.activiti.explorer.form.MonthFormType"/>  
      </list>
    </property>
  </bean>
 
  <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean" destroy-method="destroy">
   <property name="processEngineConfiguration" ref="processEngineConfiguration" />
  </bean>
 
  <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
  <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
  <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
  <bean id="formService" factory-bean="processEngine" factory-method="getFormService" />
  <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
  <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
  <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />  –>
 
</beans>
<code>

Thanks,
~Q

quirino_brizi
Champ in-the-making
Champ in-the-making
Sorry on my last comment I pasted a wrong configuration file, the beans where commented out.

<code>
cat /opt/tomcat/webapps/activiti-explorer/WEB-INF/classes/activiti-                          
activiti-custom-context.xml  activiti-login-context.xml   activiti-ui-context.xml
root@717820201d4c:/# cat /opt/tomcat/webapps/activiti-explorer/WEB-INF/classes/activiti-custom-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
  xmlns:jee="http://www.springframework.org/schema/jee" xmlns:aop="http://www.springframework.org/schema/aop"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
      
  <bean id="dbProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="classpath:db.properties" />
    <property name="ignoreUnresolvablePlaceholders" value="true" />
  </bean>
   
  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="${jdbc.driver}" />
    <property name="url" value="${jdbc.url}" />
    <property name="username" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
    <property name="defaultAutoCommit" value="false" />
  </bean>

  <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
   <property name="dataSource" ref="dataSource" />
  </bean>
 
  <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
   <property name="dataSource" ref="dataSource" />
   <property name="transactionManager" ref="transactionManager" />
   <property name="databaseSchemaUpdate" value="true" />
   <property name="jobExecutorActivate" value="false" />
    <property name="enableDatabaseEventLogging" value="true" />
    <property name="customFormTypes">
      <list>
        <bean class="org.activiti.explorer.form.UserFormType"/>
        <bean class="org.activiti.explorer.form.ProcessDefinitionFormType"/>
        <bean class="org.activiti.explorer.form.MonthFormType"/>  
      </list>
    </property>
  </bean>
 
  <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean" destroy-method="destroy">
   <property name="processEngineConfiguration" ref="processEngineConfiguration" />
  </bean>
 
  <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
  <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
  <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
  <bean id="formService" factory-bean="processEngine" factory-method="getFormService" />
  <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
  <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
  <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />
 
</beans>
<code>

Thanks,
~Q

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

Added

<code>
    <property name="asyncExecutorEnabled" value="false" />
    <property name="asyncExecutorActivate" value="false" />
<code>

as SpringProcessEngineConfiguration has double if logic but still I see jobs executed on activiti-explorer.

Thanks,
~Q