3 Replies Latest reply on Sep 27, 2012 7:19 AM by Maciej Swiderski

    last_read_date update causing StaleObjectStateException

    Richard Evans Newbie

      Hello there,

       

      jbpm 5.3.0.Final

       

      I have a server running jbpm happily on a couple of load-balanced hosts. All fine until I use a simple Web interface to view details of a running peocess. This UI calls kSession.getProcessInstance(id) to access process variables.  The server handling that process promptly gets a hibernate StaleObjectStateException. The immediate cause seems to be that getProcessInstance generates an update to process_instance_info.last_read_date. The server falls over when attempting update a process following an event.

       

      What I am attempting to do seems reasonable - providing a readonly view to an in-flight process. Is there something flawed in my approach? If I removed the call to updateLastReadDate() in JPAProcessInstanceManager would there be any repercussions other than an inaccurate value in the field?

       

      Thanks for any help.

      Richard

        • 1. Re: last_read_date update causing StaleObjectStateException
          Maciej Swiderski Master

          I believe issue you are experiencing is already resolved on master. Cause of it was persistence context was not cleared after transaction commit (extended persistence context) which in load balanced environment causes stale object exceptions. Worth to give a try with latest build to see if the issue is resolved for your environment too.

           

          HTH

          • 2. Re: last_read_date update causing StaleObjectStateException
            Richard Evans Newbie

            Thanks Maciej.

             

            Please excuse my ignorance but I have always used Maven to get my code. ...

            1) When is master likely to find itself into a new release on the maven repo?

            2) If I take code from master, I guess I'd have to take all modules from there rather than mix & match with 5.3.0. Right?

             

            As a matter of fact I have currently worked around my specific issue with a simple but nasty hack...

             

            The problem only surfaced when a read-only web application viewed a process running on another server. It happened because the read-only application actually updated the database due to the last_read_date maintenance. I therefore tweaked the code to suppress this update when the process instance is retrieved on the read-only server.  This seemed to solve our problem. 

             

            Also worth saying that on the way to this work-around I first suppressed the update of the last_read_date in all code. This did not work because, surprisingly, this had the side-effect that process_intance_info.process_instance_byte_array was never written to the db and was always null.

             

            Richard

            • 3. Re: last_read_date update causing StaleObjectStateException
              Maciej Swiderski Master

              Richard Evans wrote:

              Please excuse my ignorance but I have always used Maven to get my code. ...

              1) When is master likely to find itself into a new release on the maven repo?

              That is in fact event better, if you sonfigure it to use latest snapshot it will update it once a day unless explicitly asked to update it with -U flag.

              Richard Evans wrote:

               

              2) If I take code from master, I guess I'd have to take all modules from there rather than mix & match with 5.3.0. Right?

              yes, you need to take all or nothing so to say.

               

              Another question is why your read only web application wants to get process instance from session? If it is read only maybe history log and its query mechanism could be better fit for it?

               

              HTH