partitioned-batch-job raises NPE when used with mutiple Partiton handlers
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- backend, distributed-systems
Research direction
Start with the partitioned-batch-job sample and inspect DeployerPartitionHandler.launchWorker at line 347, where taskExecution is reported as null when multiple partition handlers are configured. Run the sample with two or more handlers and compare the execution path with a single handler. Done means the multi-handler job completes without the NullPointerException and the behavior is covered by a regression check.
Written by the indexing model from the issue text.
Description
Hello,
I modified the partitioned-batch-job sample such that to add the following method:
@Bean
public PartitionHandler partitionHandler2(TaskLauncher taskLauncher, JobExplorer jobExplorer, TaskRepository taskRepository)
{
Resource resource = this.resourceLoader.getResource("maven://fr.simplex_software.tests:partitioned-job:1.0-SNAPSHOT");
DeployerPartitionHandler partitionHandler = new DeployerPartitionHandler(taskLauncher, jobExplorer, resource, "workerStep");
List<String> commandLineArgs = new ArrayList<>(3);
commandLineArgs.add("--spring.profiles.active=worker");
commandLineArgs.add("--spring.cloud.task.initialize-enabled=false");
commandLineArgs.add("--spring.batch.initializer.enabled=false");
partitionHandler.setCommandLineArgsProvider(new PassThroughCommandLineArgsProvider(commandLineArgs));
partitionHandler.setEnvironmentVariablesProvider(new SimpleEnvironmentVariablesProvider(this.environment));
partitionHandler.setMaxWorkers(2);
partitionHandler.setApplicationName("PartitionedBatchJobTask");
return partitionHandler;
}
Running the job raises the following exception:
2021-08-06 13:12:47.071 DEBUG 13084 --- [ main] o.s.c.t.r.support.SimpleTaskRepository : Creating:
TaskExecution{executionId=149, parentExecutionId=null, exitCode=null, taskName='null', startTime=null, endTime=null,
exitMessage='null', externalExecutionId='null', errorMessage='null', arguments=[]}
2021-08-06 13:12:47.074 ERROR 13084 --- [ main] o.s.batch.core.step.AbstractStep : Encountered an error
executing step step1 in job partitionedJob-494091066
java.lang.NullPointerException: null
at
org.springframework.cloud.task.batch.partition.DeployerPartitionHandler.launchWorker(DeployerPartitionHandler.java:347)
~[spring-cloud-task-batch-2.3.3.jar:2.3.3]
at
org.springframework.cloud.task.batch.partition.DeployerPartitionHandler.launchWorkers(DeployerPartitionHandler.java:313)
~ [spring-cloud-task-batch-2.3.3.jar:2.3.3]
...
Please advise.
Many thanks in advance.
Just to mention that the NPE is raised at the line #347 of the DeployerPartitionHanlder class cause the taskExecution lcal property is null. This only happens as soon as there are 2 or more partition handlers in the job. Using different flows doesn't change anything.
- Dominant language
- Java
- Stars
- 446
- Forks
- 310
- Avg merge
- 18h 18m
- Merged PRs (30d)
- 6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from spring-cloud/spring-cloud-task
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
spring-cloud/spring-cloud-task#954 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
spring-cloud/spring-cloud-task#953 · 1 comment ·
-
status: waiting-on-feedback
Difficulty 4/5 3-5 days Newbie friendliness 25/100
spring-cloud/spring-cloud-task#952 · 2 comments ·
-
App is failing with 'taskLifecycleListener' bean initialization errors post Spring Boot 3.x upgrade Openstatus: waiting-on-feedback
Difficulty 5/5 Over a week Newbie friendliness 15/100
spring-cloud/spring-cloud-task#950 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in spring-cloud/spring-cloud-task
Similar issues
-
area-deployment area-integrations triage:bot-seen
Difficulty 2/5 Half a day Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/flink-agents#1156 ·
-
[source-shopify] FAILED bulk operation without partialDataUrl is silently treated as successful Openarea/connectors autoteam community connectors/source/shopify needs-triage team/use type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100