Announcement Announcement Module
Collapse
No announcement yet.
ConcurrentModificationException in SubclassClassifier for partitioned step Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ConcurrentModificationException in SubclassClassifier for partitioned step

    Hi,
    I have a batch job (version 2.1.7) with a partitioned step. A skippable exception was thrown but the partition failed with the stack trace below:

    at org.springframework.batch.core.step.item.FaultTole rantChunkProcessor.shouldSkip(FaultTolerantChunkPr ocessor.java:470)
    at org.springframework.batch.core.step.item.FaultTole rantChunkProcessor.access$500(FaultTolerantChunkPr ocessor.java:49)
    at org.springframework.batch.core.step.item.FaultTole rantChunkProcessor$1.doWithRetry(FaultTolerantChun kProcessor.java:240)
    at org.springframework.batch.retry.support.RetryTempl ate.doExecute(RetryTemplate.java:240)
    at org.springframework.batch.retry.support.RetryTempl ate.execute(RetryTemplate.java:187)
    at org.springframework.batch.core.step.item.BatchRetr yTemplate.execute(BatchRetryTemplate.java:213)
    at org.springframework.batch.core.step.item.FaultTole rantChunkProcessor.transform(FaultTolerantChunkPro cessor.java:291)
    at org.springframework.batch.core.step.item.SimpleChu nkProcessor.process(SimpleChunkProcessor.java:187)
    at org.springframework.batch.core.step.item.ChunkOrie ntedTasklet.execute(ChunkOrientedTasklet.java:74)
    at org.springframework.batch.core.step.tasklet.Taskle tStep$ChunkTransactionCallback.doInTransaction(Tas kletStep.java:386)
    at org.springframework.transaction.support.Transactio nTemplate.execute(TransactionTemplate.java:130)
    at org.springframework.batch.core.step.tasklet.Taskle tStep$2.doInChunkContext(TaskletStep.java:264)
    at org.springframework.batch.core.scope.context.StepC ontextRepeatCallback.doInIteration(StepContextRepe atCallback.java:76)
    at org.springframework.batch.repeat.support.RepeatTem plate.getNextResult(RepeatTemplate.java:367)
    at org.springframework.batch.repeat.support.RepeatTem plate.executeInternal(RepeatTemplate.java:214)
    at org.springframework.batch.repeat.support.RepeatTem plate.iterate(RepeatTemplate.java:143)
    at org.springframework.batch.core.step.tasklet.Taskle tStep.doExecute(TaskletStep.java:250)
    at org.springframework.batch.core.step.AbstractStep.e xecute(AbstractStep.java:195)
    at org.springframework.batch.core.partition.support.T askExecutorPartitionHandler$1.call(TaskExecutorPar titionHandler.java:109)
    at org.springframework.batch.core.partition.support.T askExecutorPartitionHandler$1.call(TaskExecutorPar titionHandler.java:107)
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:315)
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:150)
    at org.springframework.core.task.SimpleAsyncTaskExecu tor$ConcurrencyThrottlingRunnable.run(SimpleAsyncT askExecutor.java:229)
    at java.lang.Thread.run(Thread.java:736)
    Caused by:
    java.util.ConcurrentModificationException
    at java.util.HashMap$AbstractMapIterator.checkConcurr entMod(HashMap.java:122)
    at java.util.HashMap$AbstractMapIterator.makeNext(Has hMap.java:127)
    at java.util.HashMap$KeyIterator.next(HashMap.java:20 0)
    at java.util.AbstractCollection.addAll(AbstractCollec tion.java:87)
    at java.util.TreeSet.addAll(TreeSet.java:141)
    at org.springframework.batch.classify.SubclassClassif ier.classify(SubclassClassifier.java:110)
    at org.springframework.batch.core.step.skip.LimitChec kingItemSkipPolicy.shouldSkip(LimitCheckingItemSki pPolicy.java:127)
    at org.springframework.batch.core.step.skip.Exception ClassifierSkipPolicy.shouldSkip(ExceptionClassifie rSkipPolicy.java:69)
    at org.springframework.batch.core.step.item.FaultTole rantChunkProcessor.shouldSkip(FaultTolerantChunkPr ocessor.java:464)
    ... 23 more

    My step uses the default skip policy:
    <batch:step id="tokenProcessorStep.master" next="tokenProcessorFinalizationStep">
    <batchartition step="tokenProcessorStep"
    partitioner="tokenPartitioner">
    <batch:handler grid-size="${batch.tokenProcessorBatch.partitions}"
    task-executor="taskExecutor" />
    </batchartition>
    </batch:step>

    <batch:step id="tokenProcessorStep" parent="abstractStep">
    <batch:tasklet>
    <batch:chunk reader="tokenProcessorReader" processor="tokenEventProcessor"
    writer="tokenEventWriter" commit-interval="${batch.tokenProcessorBatch.commit.inter val}"
    skip-limit="${batch.tokenProcessorBatch.skip.limit}"
    processor-transactional="false" >
    <batch:skippable-exception-classes>
    <batch:include class="java.lang.Exception" />
    </batch:skippable-exception-classes>
    </batch:chunk>
    <batch:listeners>
    <batch:listener ref="tokenProcessorSkipListener"/>
    <batch:listener ref="exceptionHandler"/>
    </batch:listeners>
    </batch:tasklet>
    <batch:next on="FAILED" to="tokenProcessorFinalizationStep" />
    </batch:step>

    Is this the result of a synchronization issue in the application code? The partitioner, reader and writer are all defined in step scope. Please suggest.
    Thanks,
    Hari.

  • #2
    I see that this has been fixed in 2.1.8

    Comment

    Working...
    X