6 Replies Latest reply on May 30, 2006 6:09 AM by patrickvanamstel

    couldn't commit hibernate session (java.lang.OutOfMemoryErro

    patrickvanamstel

      I'm tring to commit the JbpmContext at the end with context1.close();

      It seems to be a problem of having to many variables in my
      workflow.

      Question:
      Is there a way of flushing or nulling variables in the workflow.

      I've tried to delete the variables or null them but that did not seem to work.
      If i use less variables i do not get the out of memory.

      Question:
      Can there be an intermediate HibernateUpdate?

      Any hints are welcome


      JbpmContext context1 = null;
      try
      {
      ProcessDefinition pd = ProcessDefinition.parseXmlResource("FileSplitter.par/processdefinition.xml");
      context1 = this.jbpmConfiguration.createJbpmContext();
      ProcessInstance instance = new ProcessInstance(pd);
      context1.deployProcessDefinition(pd);
      instance.signal();
      context1.save(instance);
      } catch (Exception e)
      {

      e.printStackTrace();
      }finally {
      context1.close();
      }

        • 1. Re: couldn't commit hibernate session (java.lang.OutOfMemory
          patrickvanamstel

          The problem is fixed by setting the ehcache to a more conservative objects in memory setting

          • 2. Re: couldn't commit hibernate session (java.lang.OutOfMemory
            patrickvanamstel

            Solution does not seem to work. So i was a bit to soon.

            So ony tips would be welcome.

            Is there maybe a hibernate setting i can use??

            • 3. Re: couldn't commit hibernate session (java.lang.OutOfMemory
              kukeltje

              can you profile the application and see what takes up the memory?

              btw, how many variables are you using in your processdefinition? I never get any higher than 20-25 in development fase and 10 if I change to using a dossier for most business info

              • 4. Re: couldn't commit hibernate session (java.lang.OutOfMemory
                patrickvanamstel

                Thank you for your reaction. Back from holiday i'm continueing
                my quest for variables and memory usage/

                I'm not used using profiling tools.

                But in short i'm doing the programatic fork / join. In the fork i create variable's which are byte arrays.

                final ExecutionContext newExecutionContext = new ExecutionContext(newToken);
                //newExecutionContext.getContextInstance().createVariable(Constants.XML_DOCUMENT_STRING,baos.toByteArray(), newToken);
                newExecutionContext.getContextInstance().createVariable(Constants.XML_DOCUMENT_STRING,baos.toByteArray(), newToken);
                newExecutionContext.getJbpmContext().save(executionContext.getProcessInstance());


                There could be 10.000 variables created. So it is important that the memory usage is as low as possible.

                Is it possible to commit the hiberbate transaction inbetween. Cause after
                the last line a commit would be fine by me.

                The biggist question ofcourse is. How does the transaction influence the
                memory usage. And when are the variables persisted.

                Maybe jbpm is not the proper java framework for processing
                this, but it seemed very usefull. So here some context

                Process in short is:
                One file -> validate
                Split - file -> (10 till 100.000)
                If failure user interaction
                Otherwise -> continue till done
                Report to customer
                Report to calculations




                The user interaction will only happen when the instream fails.

                • 5. Re: couldn't commit hibernate session (java.lang.OutOfMemory
                  kukeltje

                  For storing this kind/amount of data we (the company I work for) do not use jbpm variables. We store the data externally and store a reference to it in a jbpm variable.

                  The number of variables per processinstance in development can grow to 20-30 but eventually it almost never exceeds 10.

                  Is this a possible solution?

                  • 6. Re: couldn't commit hibernate session (java.lang.OutOfMemory
                    patrickvanamstel

                    If that is the way to go i must consider it. Because i do not want to go against the flow.

                    But actually i solved the problem by adding to line of code to the persistance code.

                    DbPersistenceService.java

                    // added
                    session.flush();

                    session.clear();

                    // before
                    transaction.commit();

                    This seems to help my out of memory.

                    But i havent testet it to death yet.

                    But wat i want to do next is off load the variables to a queue
                    and process it from there.

                    But now i'm first trying to get a grip on the logging.

                    (Now posting a new post about the processInstance id)

                    thx Patrick