5 Replies Latest reply on Jul 26, 2013 3:49 AM by Maciej Swiderski

    How to remove the process instance when the abort fails

    Ashok Kuppuswamy Newbie

      Because of a system error in the backend, some process instances went into some state that it's not able to proceed further.

      I thought I should always be able to abort the process instance in the event something like this happens.

      But in some cases abort process instance also fails and there seems to be no other way to get rid of that process instance.

      I can paste the whole stack trace error here.

       

      But I am just wondering if there is a alternate way to get rid of these like removing some entries in the backend.

        • 1. Re: How to remove the process instance when the abort fails
          Maciej Swiderski Master

          yes, the abort should be the way to go. Could you provide the stack trace for examination? We need to find the cause of why the process instance is in non recoverable state.

           

          Cheers

          • 2. Re: How to remove the process instance when the abort fails
            Ashok Kuppuswamy Newbie

            {code}

            2013-03-27 12:52:35 [http-49021-2] DEBUG bitronix.tm.BitronixTransaction  - executing synchronization a ClearContextSynchronization for a Bitronix Transaction with GTRI

            D [737072696E672D62746D0000013DACC3F19E00000032], status=COMMITTED, 0 resource(s) enlisted (started Wed Mar 27 12:52:35 EDT 2013) with status=COMMITTED

            2013-03-27 12:52:35 [http-49021-2] DEBUG bitronix.tm.BitronixTransactionManager  - clearing thread context: a ThreadContext with transaction a Bitronix Transaction with

            GTRID [737072696E672D62746D0000013DACC3F19E00000032], status=COMMITTED, 0 resource(s) enlisted (started Wed Mar 27 12:52:35 EDT 2013), default timeout 60s

            2013-03-27 12:52:35 [http-49021-2] INFO  org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler  - User '[User:'Administrator']' was unable to execution operation 'Exi

            t' on task id 32 due to a no 'current status' match

            2013-03-27 12:52:35 [http-49021-2] ERROR org.drools.persistence.SingleSessionCommandService  - Could not commit session

            java.lang.IllegalArgumentException: Removing a detached instance org.drools.persistence.info.WorkItemInfo#32

                    at org.hibernate.ejb.event.EJB3DeleteEventListener.performDetachedEntityDeletionCheck(EJB3DeleteEventListener.java:45)

                    at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:108)

                    at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:74)

                    at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:794)

                    at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:772)

                    at org.hibernate.ejb.AbstractEntityManagerImpl.remove(AbstractEntityManagerImpl.java:253)

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                    at java.lang.reflect.Method.invoke(Method.java:597)

                    at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365)

                    at $Proxy32.remove(Unknown Source)

                    at org.drools.persistence.jpa.JpaPersistenceContext.remove(JpaPersistenceContext.java:54)

                    at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalAbortWorkItem(JPAWorkItemManager.java:88)

                    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.cancel(WorkItemNodeInstance.java:257)

                    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:257)

                    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:269)

                    at org.jbpm.process.instance.ProcessRuntimeImpl.abortProcessInstance(ProcessRuntimeImpl.java:371)

                    at org.drools.impl.StatefulKnowledgeSessionImpl.abortProcessInstance(StatefulKnowledgeSessionImpl.java:301)

                    at org.drools.command.runtime.process.AbortProcessInstanceCommand.execute(AbortProcessInstanceCommand.java:42)

                    at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)

                    at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)

                    at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.abortProcessInstance(CommandBasedStatefulKnowledgeSession.java:131)

            {code}

            • 3. Re: How to remove the process instance when the abort fails
              Maciej Swiderski Master

              Looks like issue with transaction and persistence context, I see you use spring so might be some configuration issue.

               

              HTH

              • 4. Re: How to remove the process instance when the abort fails
                Eduard Rameder Newbie

                Hi,

                 

                We faced the exact same problem. It seams the process engine sends an abort signal to each workItem (actually the fitting workItemHandler). Which is fine.

                BUT: standard implentation of the HumanTaskWorkItemHandler would fail if you send abort ("exit"-command) to a completed task.

                Fix:

                Allow the exit-command on an already completed task and do nothing with it.

                 

                operations-dsl.mvel:

                ...

                } ],
                Operation.Exit
                    : [ new OperationCommand().{
                            status = [ Status.Created, Status.Ready, Status.Reserved, Status.InProgress, Status.Suspended ],
                            allowed = [ Allowed.BusinessAdministrator ],
                            newStatus = Status.Exited
                        },new OperationCommand().{
                            status = [ Status.Completed ],
                            allowed = [ Allowed.BusinessAdministrator ],
                            newStatus = Status.Completed
                        } ]
                ]

                ...

                 

                regards from Vienna

                Edi

                • 5. Re: How to remove the process instance when the abort fails
                  Maciej Swiderski Master

                  The issue with this is that it would be very misleading as you call exit on already completed tasks and then leaving the status as completed again. I would vote more for protecting the abort operation to not fail on such situation, meaning if the task is in different state than expected by exit command it should issue warning instead of failing on that.

                   

                  Moreover there must be something wrong when you have task completed but the work item is not completed and thus process instance abort aborts the work item as well. That indicates that your process instance was not notified about task completion and thus remains in active state instead of being completed.

                   

                  HTH