2 Replies Latest reply on Apr 14, 2015 1:20 PM by cwtob

    How to force abort/delete stuck process instances?

    cwtob

      In running a jBPM workflow that has AsyncWorkItemHandlers, I consistently get processes that are 'stuck' and fail to complete.  When this happens, I am unable to abort the process instances from within the console.  When attempting to abort the process from the console, my latest error is:

       

      Unexpected error encountered : Invalid session was used for this context org.kie.internal.runtime.manager.context.ProcessInstanceIdContext@6160ad1

       

      The only way I've found to clear the stuck processes is to stop wildfly and delete the H2 database.  Is there another way to force delete stuck process instances?

        • 1. Re: How to force abort/delete stuck process instances?
          swiderski.maciej

          could you describe bit more about your use case?

           

          It looks like you're using per process instance strategy and try to use another ksession (that is not bound to given process instance) to perform operations on it. If you could provide an example process or project to reproduce that that will be helpful.

           

          HTH

          • 2. Re: How to force abort/delete stuck process instances?
            cwtob

            Hi Maciej,

             

            I will put together a smaller sample process but it will take me a bit.

             

            The high-level flow is: we have a workflow with a diverging gateway that executes two Call Activity sub-processes.  These sub-processes each invoke custom work items that implement AsyncWorkItemHandler and AsyncWorkItemHandlerCmdCallback.

             

            The majority of the time I run the main process through the jBPM console using either the Per Process Instance or Per Request runtime manager, the process execution will hang (it occasionally passes).  As far as I can tell, the hang comes at the end of an async work item completion, when the state is being persisted.  The exception I see is:

             

            2015-04-07 16:13:11,434 WARN  [com.arjuna.ats.arjuna] (EJB default - 7) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffff0b100a68:-3925aeb0:55244fd5:2e3f, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@6dce2955 >: javax.persistence.PersistenceException: error during managed flush

              at org.hibernate.jpa.spi.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1887) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:115) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:50) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

              at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)

              at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:358)

              at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)

              at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)

              at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1166)

              at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)

              at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)

              at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:173)

              at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:209) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

              at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:512) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

              at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.1.0.Final.jar:6.1.0.Final]

              at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:73) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

              at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.1.0.Final.jar:6.1.0.Final]

              at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:60) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

              at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:353) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

              at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:145) [drools-core-6.1.0.Final.jar:6.1.0.Final]

              at org.jbpm.executor.impl.wih.AsyncWorkItemHandlerCmdCallback.onCommandDone(AsyncWorkItemHandlerCmdCallback.java:62) [jbpm-executor-6.1.0.Final.jar:6.1.0.Final]

              at org.jbpm.executor.impl.AvailableJobsExecutor.executeJob(AvailableJobsExecutor.java:125) [jbpm-executor-6.1.0.Final.jar:6.1.0.Final]

              at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source) [:1.7.0_71]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_71]

              at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_71]

              at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

              at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:407)

              at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82) [wildfly-weld-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93) [wildfly-weld-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

              at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47) [wildfly-jpa-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:104) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:56) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:407)

              at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]

              at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83) [wildfly-weld-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45) [wildfly-ee-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

              at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.interceptors.NonPooledEJBComponentInstanceAssociatingInterceptor.processInvocation(NonPooledEJBComponentInstanceAssociatingInterceptor.java:59) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:95) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326)

              at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:448)

              at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326)

              at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

              at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:185)

              at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.interceptors.LogDiagnosticContextRecoveryInterceptor.processInvocation(LogDiagnosticContextRecoveryInterceptor.java:79) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.interceptors.AsyncFutureInterceptorFactory$1$2.runInvocation(AsyncFutureInterceptorFactory.java:97) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.as.ejb3.component.interceptors.AsyncInvocationTask.run(AsyncInvocationTask.java:73) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_71]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_71]

              at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]

              at org.jboss.threads.JBossThread.run(JBossThread.java:122)

            Caused by: java.lang.NullPointerException

              at org.drools.core.marshalling.impl.MarshallerWriteContext.<init>(MarshallerWriteContext.java:109) [drools-core-6.1.0.Final.jar:6.1.0.Final]

              at org.drools.core.marshalling.impl.MarshallerWriteContext.<init>(MarshallerWriteContext.java:75) [drools-core-6.1.0.Final.jar:6.1.0.Final]

              at org.jbpm.persistence.processinstance.ProcessInstanceInfo.update(ProcessInstanceInfo.java:207) [jbpm-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

              at sun.reflect.GeneratedMethodAccessor139.invoke(Unknown Source) [:1.7.0_71]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_71]

              at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_71]

              at org.hibernate.jpa.event.internal.jpa.EntityCallback.performCallback(EntityCallback.java:47) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.jpa.event.internal.jpa.CallbackRegistryImpl.callback(CallbackRegistryImpl.java:112) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.jpa.event.internal.jpa.CallbackRegistryImpl.preUpdate(CallbackRegistryImpl.java:76) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.jpa.event.internal.core.JpaFlushEntityEventListener.invokeInterceptor(JpaFlushEntityEventListener.java:67) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.event.internal.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:342) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.event.internal.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:293) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:160) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:231) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:102) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:55) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1222) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:425) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

              at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:110) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

              ... 90 more

                   

            I'll work today to try to create a reproducible sample project.

             

            Thanks,

            Jason