Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed JobExecution due to unavailable TaskExecutor leaves End Time unpopulated [BATCH-2760] #844

Closed
spring-issuemaster opened this issue Sep 25, 2018 · 5 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Sep 25, 2018

Dimitrios Liapis opened BATCH-2760 and commented

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.


Affects: 3.0.9, 4.0.1, 4.1.0.RC1

Issue Links:

  • BATCH-2675 Rejected Job can not be restarted
    ("duplicates")

Referenced from: pull request #643

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 26, 2018

Mahmoud Ben Hassine commented

Good catch! Thank you for reporting this. For the fix, I would go for option 2 because option 1 will return the failed job execution as a running execution which is obviously not the case. So setting the end time along with the status to FAILED when the task submission fails makes more sense to me.

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 26, 2018

Dimitrios Liapis commented

Many thanks for very prompt reply. It makes sense. I've opened PR: #643

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 5, 2018

Mahmoud Ben Hassine commented

I believe this is a duplicate of BATCH-2675. So I'm resolving this ticket as a duplicate.

Dimitrios Liapis Please keep your PR open. We will consider merging it as a fix. Thank you.

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 9, 2018

Dimitrios Liapis commented

Subsequent discussion for this issue is continuing in the comment section of https://jira.spring.io/browse/BATCH-2675

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 18, 2018

Dimitrios Liapis commented

After several discussions logged under the comment section of BATCH-2675, a new PR has been raised: #659

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.