spring-projects / spring-projects/spring-batch

Job operator restart failed step issue

Open
#4,647 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-reporter type: bug
Dominant language
Java
Stars
3k
Forks
2.5k
Avg merge
6d 53m
Merged PRs (30d)
3

Description

Bug description
I have a spring batch job with eg : 4 steps, the second steps fails and the flow is such that I need to update details so it goes on to the 3rd and 4th steps marks them as complete.
In the end of the job I update the job execution with status and exit status as failed and restart the job.
Step execution :

  1. Status - completed , exitstatus - completed
  2. Status - failed , exitstatus - failed
  3. Status - completed , exitstatus - completed
  4. Status - completed , exitstatus - completed
    Job execution status failed and exit status failed

On restart non of the steps are executed again and the job ends successfully.
I want to restart the job from the failed step.

Now if I try to fail the last 3 steps
Step execution :

  1. Status - completed , exitstatus - completed
  2. Status - failed , exitstatus - failed
  3. Status - failed , exitstatus - failed
  4. Status - failed , exitstatus - failed
    Job execution status failed and exit status failed

Here only the step 4 is executed on the restart, it's taking only the last failed step.
Environment
Please provide as many details as possible: Spring batch version - 5.1.2
Java version 17

Steps to reproduce
Given above

Expected behavior
How can I make the job restart from the second step which is the actual failed step

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the described four-step Spring Batch job on Spring Batch 5.1.2 and Java 17, including the cases where steps 3 and 4 are marked completed or failed. Inspect restart behavior and step execution state around the failed second step. Done means a restart reruns the actual failed step rather than skipping it or running only the last failed step.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.