1 2 Previous Next 21 Replies Latest reply on May 23, 2006 6:50 PM by julian_k Go to original post
      • 15. Re: Required indexes missing in JBPM DB script. (Take 2 - De
        biggef

        As I said, when entering a task more than once (k is the number of time the node was reached), a cancellation of the task was made in order not to ask for some information already gathered.

        if (k>1) {
        ti.cancel();
        return;
        }
        But such a cancellation leads to leaving the node along the default transition, which was not the goal and which, in my context, was leading to a deadlock.

        So I removed the ti.cancel() and used an other way to prevent from leaving the state. (and I found another way not to gather the same information several times, but this has nothing to do with this post ;) )


        • 16. Re: Required indexes missing in JBPM DB script. (Take 2 - De
          julian_k

          Thanks for the input, I may have the same problem. Originally, my problem seemed to be related to the JBPM_LOG table:

          Batch entry 0 insert into JBPM_LOG (INDEX_, DATE_, TOKEN_, PARENT_, TRANSITION_, SOURCENODE_, DESTINATIONNODE_, CLASS_, ID_) values ( was aborted. Call getNextException() to see the cause.
          


          However the code that calls it, does end one task (looks like a set in the code below, but it is only one). Then the code tries to retrieve the newly created tasks that are generated by ending the previous task and taking the default transition. The strange thing is that this code will cause a deadlock sometimes, and not others. Do I need to flush the JbpmSession or Hibernate session before iterating the new tasks to avoid this problem as the transaction is not comitted until the finally block. If so how? Thanks.

          ProcessInstance pi = session.getGraphSession().loadProcessInstance(Long.valueOf(processInstanceID));
          //remove complaint variable
          ContextInstance contextInstance = pi.getContextInstance();
          contextInstance.deleteVariable("complaint");
          
          //end current tasks in order to follow the default transition
          Collection<MyTaskInstance> tasks = pi.getTaskMgmtInstance().getTaskInstances();
          for(MyTaskInstance ti:tasks){
           ti.end();
          }
          
          //DO I NEED TO FLUSH THE TRANSACTION HERE?
          
          //set new tasks names and assign to the user location
          tasks = pi.getTaskMgmtInstance().getTaskInstances();
          for(MyTaskInstance ti:tasks){
           if(!ti.hasEnded()){
           ti.setDescription(user.getFirstName() + " " + user.getLastName() + " - "
          + locationID + " - " +
          new SimpleDateFormat("MM/dd/yyyy").format(new Date()));
           ti.setActorId(createAssignmentExpression(accountID,locationID));
           }
          }
          session.getGraphSession().saveProcessInstance(pi);
          
          *...finally block omitted where session is closed....*
          


          • 17. Re: Required indexes missing in JBPM DB script. (Take 2 - De
            julian_k

            bump

            • 18. Re: Required indexes missing in JBPM DB script. (Take 2 - De
              biggef

               

              "julian_k" wrote:
              The strange thing is that this code will cause a deadlock sometimes, and not others.


              Do you know when a deadlock occurs and when it does not ? Is there every time only one transition fired during your session ? Or is there several sometimes several ones for the same process instance ?

              PS: can you provide more logs especially the cause of your error: "Call getNextException() to see the cause."

              • 19. Re: Required indexes missing in JBPM DB script. (Take 2 - De
                julian_k

                I do not know when the deadlock occurs and when it doesn't b/c our users are uncooperative :( However thre is only one transition in the process definition, no more, no less, everytime. And finally, a call to getNextException() returns:


                org.hibernate.event.def.AbstractFlushingEventListener.performExecutions at line 277

                Could not synchronize database state with session

                org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:181) at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:74) at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:69) at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:150) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1839) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200) at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86) at org.springframework.workflow.jbpm.JbpmTemplate.execute(JbpmTemplate.java:407) at com.mycompany.manager.WorkflowManager.callUserCallBackTask(WorkflowManager.java:267) at com.mycompany.web.controller.UserController.generateExitReports(PatientController.java:182) at sun.reflect.GeneratedMethodAccessor462.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:351) at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:305) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:128) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625) at org.springframework.web.servlet.FrameworkServlet.serviceWrapper(FrameworkServlet.java:386) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:346) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.mycompany.commons.servlet.filter.FirewallFilter.doFilter(FirewallFilter.java:189) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595)Caused by: Batch entry 0 insert into JBPM_LOG (INDEX_, DATE_, TOKEN_, PARENT_, TRANSITION_, SOURCENODE_, DESTINATIONNODE_, CLASS_, ID_) values ( was aborted. Call getNextException() to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:105) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:174) ... 49 more

                and then the next exception returns this:
                ERROR: deadlock detected
                


                • 20. Re: Required indexes missing in JBPM DB script. (Take 2 - De
                  biggef

                  Your stack trace looks indeed close to the one I had.
                  Look maybe how often the commits are made. Try to commit more frequently to see if you still get this error. I don't know what else to say.

                  • 21. Re: Required indexes missing in JBPM DB script. (Take 2 - De
                    julian_k

                    I will try, the error has not occured in a while. I imagine it must only happen under heavy load. Thanks for the pointers.

                    1 2 Previous Next