Skip to content

Step never launched when restarting a failed loop flow job [BATCH-2703] #906

Open
@spring-projects-issues

Description

@spring-projects-issues

Damien Lenci opened BATCH-2703 and commented

My job is using a flow of 3 steps (A, B, C) in a loop.
When no error occurs, the job executes fine : A -> B -> C -> A -> B -> C ->...
If an error occurs on step B and I try to restart the job, I would expect the following execution :
B -> C -> A -> B -> C ->...
Instead, step A is never executed again, resulting in the execution B -> C -> B -> C -> ...

Looking at SimpleStepHandler, maybe the following behaviour shoud be extended to remove the last execution of an already skipped step :

if (stepExecutionPartOfExistingJobExecution(execution, lastStepExecution)) {
	// If the last execution of this step was in the same job, it's
	// probably intentional so we want to run it again...
	logger.info(String.format("Duplicate step [%s] detected in execution of job=[%s]. "
					+ "If either step fails, both will be executed again on restart.", step.getName(), jobInstance
					.getJobName()));
	lastStepExecution = null;
}

Affects: 3.0.7

Issue Links:

  • BATCH-2533 Restarting a job that failed before going back to a previous step is not working well

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions