Uploaded image for project: 'Red Hat Process Automation Manager'
  1. Red Hat Process Automation Manager
  2. RHPAM-292

Endpoint /history/clear not responsive

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • 6.x.x
    • Business Central
      • Any supported database (reproduced with MySQL and Postgres only)
    • 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
            Tomáš Livora Tomáš Livora (Inactive)
            Tomáš Livora Tomáš Livora (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: