Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-2797

Bug in LockMonitor unlocks EVERY Job, not only overdue ones

    XMLWordPrintable

Details

    Description

      The LockMonitorThread has a really huge bug.

      It queries all jobs with overdue lock time:
      Date threshold = new Date(System.currentTimeMillis() - maxLockTime - lockBufferTime);
      List overdueJobs = jbpmContext.getJobSession().findJobsWithOverdueLockTime(threshold);

      by this query:

      <query name="JobSession.findJobsWithOverdueLockTime">
      select job
      from org.jbpm.job.Job as job
      where job.lockTime > :threshold
      </query>

      This finds all jobs with a lock timer NEWER than the treshold, not OLDER as it should be. So the query must be:

      <query name="JobSession.findJobsWithOverdueLockTime">
      select job
      from org.jbpm.job.Job as job
      where job.lockTime < :threshold
      </query>

      So if a job runs exactly at the time the LockMonitorThread comes active, this leads to a StaleObjectException in the JobExecution. Since the LockMonitorThread runs only every minute, this is a pretty rare case. The more puzzling it was to find Surprising, that it wasn't recognized that long!

      I commit the changed query to HEAD.

      Attachments

        Issue Links

          Activity

            People

              aguizar_jira Alejandro Guizar (Inactive)
              camunda_jira Bernd Ruecker (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: