3 Replies Latest reply on Sep 18, 2012 4:42 PM by Michał Mański

    Process instance doesn't go on after server reboot

    Michał Mański Newbie

      Hi,

      I use JBPM 5.3.0.Final in my project and I noticed that it doesn't work properly after restart of the server. When a process instance is started and still not finished (for example it is waiting for completion of human task) and suddenly server is crashed or restarted, the process instance doesn't go on after server reboot. When I call complete on taskService, current human task is marked as completed (I see in db that status of this task has changed) but the process instance is not processed to the next node/task.

       

      It doesn't work regardless of whether I create a new StatefulKnowledgeSession or load a previous one after server restart.

       

      My application uses EJB 3.1/JPA 2.0 and runs on JBoss 7.1.1.Final.

       

      Does anyone know what could cause this problem?

        • 1. Re: Process instance doesn't go on after server reboot
          nbd Newbie

          Hi,

           

          I have the same problem. I tested against exactly the same process flow that you have. Tried restoring the session as well which doesn't help - process instances won't continue executing after server restart.

          You may want to take a look here: https://community.jboss.org/thread/200708.

           

          There is an answer:

           

          Hey,

           

          at the moment of the "crash", the processes has been persisted? A process is persisted when it reaches a "wait state". I catching signal event is a wait state.

           

          If so, you can simply do,

          ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase, null, env);

          ksession.signalEvent("Trigger", null);

           

          as the processes are already persisted in db.

           

          Demian

           

          I don't get the answer at all and I don't know what ksession.signalEvent("Trigger", null); is supposed to do here. Anyway, I tried it, didn't work, but maybe you can

          get something usefull out of this topic.

           

          I'm also still looking for a solution to this problem.

          • 3. Re: Process instance doesn't go on after server reboot
            Michał Mański Newbie

            Thanks for the reply, but it doesn't resolve my problem.

             

            I started to debug the code in detail and I managed to find the cause and resolve the problem. It turned out that the cause was as follows the state of ProcessInstanceInfo was not often saved in the database after process moved to the next task. Thus, old state of process instance was read after server reboot and process instance couldn't go on to the next node/task properly.

             

            For entity mapping of ProcessInstanceInfo I used JBPMorm-JPA2.xml that I had found in jbpm-persistence-jpa-5.3.0.Final.jar. It turned out that the mapping of fields of type date was incorrect, because these fields were marked with DATE but should have been marked with TIMESTAMP.

            This resulted in not updating state of ProcessInstanceInfo in database. Updates are made only when value of any field (except of clob column) of the ProcessInstanceInfo is changed, but often only lastReadDate is changed during process instance execution. Thus, when many human tasks of the same process instance is executed on the same day, value of lastReadDate field doesn't change because it ignores the time part of the current timestamp.

             

            When I changed in date fields mapping from DATE to TIMESTAMP, all process instances are executed properly after server restart.