Uploaded image for project: 'Spring Batch'
  1. Spring Batch
  2. BATCH-2760

Failed JobExecution due to unavailable TaskExecutor leaves End Time unpopulated

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 3.0.9, 4.0.1, 4.1.0.RC1
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None

      Description

      While executing SimpleJobLauncher#run() assuming that the taskExecutor cannot pick up the submitted Job Execution then a TaskRejectedException will be thrown setting the Job Execution's status to FAILED

       

      On the other hand when querying the JobExplorer via SimpleJobExplorer#findRunningJobExecutions() for running Job Executions the query that is issues is taking a decision expecting the END TIME to be null:

      JDBC call

      Query link 

      or also quoted here:

      SELECT E.JOB_EXECUTION_ID, E.START_TIME, E.END_TIME, E.STATUS, E.EXIT_CODE, E.EXIT_MESSAGE, E.CREATE_TIME, E.LAST_UPDATED, E.VERSION, E.JOB_INSTANCE_ID, E.JOB_CONFIGURATION_LOCATION from %PREFIX%JOB_EXECUTION E, %PREFIX%JOB_INSTANCE I where E.JOB_INSTANCE_ID=I.JOB_INSTANCE_ID and I.JOB_NAME=? and E.END_TIME is NULL order by E.JOB_EXECUTION_ID desc

       

      We can fix that by either:

       

      1. Enhancing the GET_RUNNING_EXECUTIONS query to also taking into account the above case
      2. or set the End Time directly when updating the Job Execution to FAILED Batch Status here

       

      What do you think? I can submit a PR for either case.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dimitrisli Dimitrios Liapis
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: