-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Labels
status: waiting-for-triageIssues that we did not analyse yetIssues that we did not analyse yettype: bug
Description
Bug description
calling unregisterStepsFromJob and getStep from two Threads in parallel can lead to a NullPointerException
Environment
Spring Batch Version 5.2.3
All Jdk Versions, I tried jdk 17 and 21
Steps to reproduce
Here is an example which can lead to this race condition:
StepRegistry registry = new MapStepRegistry();
registry.register("foo", List.of(new TaskletStep("first")));
Thread first = new Thread() {
@Override
public void run() {
registry.unregisterStepsFromJob("foo");
}
};
first.start();
try {
registry.getStep("foo", "first");
}
catch (NoSuchJobException e) {
}
Expected behavior
getStep should either return the Step or throw a NoSuchJobException.
Minimal Complete Reproducible example
Failing Tests
I used vmlens to make the test execute all thread interlreavings and make the test reproducible
Metadata
Metadata
Assignees
Labels
status: waiting-for-triageIssues that we did not analyse yetIssues that we did not analyse yettype: bug