Uploaded image for project: 'JBoss BPMS Platform'
  1. JBoss BPMS Platform
  2. RHBPMS-4447

[GSS](6.4.z)Endpoint /history/clear not responsive

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.4.1
    • 6.3.3, 6.4.0
    • Business Central
      • Any supported database (reproduced with MySQL and Postgres only)
    • Release Notes
    • CR1
    • Hide
      Show
      Delete these tables lines directly in the database; USe LogCleanupCommand as described in this article: http://mswiderski.blogspot.com.br/2014/12/keep-your-jbpm-environment-healthy.html
    • Hide
      Show
      Generate more than 100k on tables ProcessIntanceLog, NodeInstanceLog and VariableInstanceLog; Run: curl -X POST -u 'bpmsAdmin:redhat2014!' http://localhost:8080/business-central/rest/history/clear

      When you have more than 150 records on *Log tables and try to delete the history using the REST API:

      curl -X POST -u 'bpmsAdmin:redhat2014!' http://localhost:8080/business-central/rest/history/clear

      The server hangs and never finish the request. We can see a transaction timeout in logs (expected since it takes more than 5 minutes, the default transaction timeout in JBoss EAP)

      Checking the sources, we see that the code tries to delete record by record and it is not good when we have more 200k registers in each table. Check the JPAAuditLogService clear method:

      Unable to find source-code formatter for language: java. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      @Override
      public void clear() {
          EntityManager em = getEntityManager();
          Object newTx = joinTransaction(em);
          try {
              List<ProcessInstanceLog> processInstances = em.createQuery("FROM ProcessInstanceLog").getResultList();
              for (ProcessInstanceLog processInstance: processInstances) {
                  em.remove(processInstance);
              }
              List<NodeInstanceLog> nodeInstances = em.createQuery("FROM NodeInstanceLog").getResultList();
              for (NodeInstanceLog nodeInstance: nodeInstances) {
                  em.remove(nodeInstance);
              }
              List<VariableInstanceLog> variableInstances = em.createQuery("FROM VariableInstanceLog").getResultList();
              for (VariableInstanceLog variableInstance: variableInstances) {
                  em.remove(variableInstance);
              }
          } finally {
          	closeEntityManager(em, newTx);
          }
      }
      

      May we instead use a direct command to clean these tables?

              swiderski.maciej Maciej Swiderski (Inactive)
              rhn-support-wsiqueir William Siqueira
              Jiri Petrlik Jiri Petrlik
              Jiri Petrlik Jiri Petrlik
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: