Announcement Announcement Module
No announcement yet.
DiskFull IOException does not result in a failed job when writing to a file Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • DiskFull IOException does not result in a failed job when writing to a file


    We had the situation, that we had a Disk-Full IOException during writing with a FlatFileItemWriter. What was strange is,
    that the step ended with a COMPLETED state (in the batch db-tables). The only reason we noticed that there was
    a failing step afterwards which tried to open a new file for writing.

    I would have expect, that an IOException during writing would cause the step to fail.

    The problem occurred in an CompositeStreamItemWriter with to writers. One writing to a Flat-file and another writing
    to an XML-File.

    I did a look at the code and noticed, that TransactionAwareBufferedWriter the IOException is transformed into an
    FlushFailedException. This is actually called from TransactionSynchronizationUtils.invokeAfterComplet ion which catches
    all Throwables and simply logs them.

    below is the call stack.

    Thread [main] (Suspended (breakpoint at line 171 in TransactionSynchronizationUtils))	
    	TransactionSynchronizationUtils.invokeAfterCompletion(List<TransactionSynchronization>, int) line: 171	
    	JpaTransactionManager(AbstractPlatformTransactionManager).invokeAfterCompletion(List<TransactionSynchronization>, int) line: 996	
    	JpaTransactionManager(AbstractPlatformTransactionManager).triggerAfterCompletion(DefaultTransactionStatus, int) line: 971	
    	JpaTransactionManager(AbstractPlatformTransactionManager).processCommit(DefaultTransactionStatus) line: 799	
    	JpaTransactionManager(AbstractPlatformTransactionManager).commit(TransactionStatus) line: 723	
    	TransactionTemplate.execute(TransactionCallback<T>) line: 147	
    	TaskletStep$2.doInChunkContext(RepeatContext, ChunkContext) line: 262	
    	TaskletStep$2(StepContextRepeatCallback).doInIteration(RepeatContext) line: 76	
    	RepeatTemplate.getNextResult(RepeatContext, RepeatCallback, RepeatInternalState) line: 367	
    	RepeatTemplate.executeInternal(RepeatCallback) line: 214	
    	RepeatTemplate.iterate(RepeatCallback) line: 143	
    	TaskletStep.doExecute(StepExecution) line: 248	
    	TaskletStep(AbstractStep).execute(StepExecution) line: 195	
    	SimpleStepHandler.handleStep(Step, JobExecution) line: 135	
    	JobFlowExecutor.executeStep(Step) line: 61	
    	StepState.handle(FlowExecutor) line: 60	
    	SimpleFlow.resume(String, FlowExecutor) line: 144	
    	SimpleFlow.start(FlowExecutor) line: 124	
    	FlowJob.doExecute(JobExecution) line: 135	
    	FlowJob(AbstractJob).execute(JobExecution) line: 281	
    	SimpleJobLauncher$ line: 120	
    	SyncTaskExecutor.execute(Runnable) line: 48, JobParameters) line: 114	
    	BatchJobAgent(AbstractBatchAgent).launchJob(Job, JobParameters, boolean) line: 85 line: 190
    It's clear to me, that inside invokeAfterCompletion no further exceptions may be thrown. But why the heck is the
    file writing done inside invokeAfterCompletion?

    Is there a way, that a Step fails when there is an IOException during writing with a FlatFileItemWriter or an
    StaxEventItemWriter? Do I miss something here?

    BTW, I'm using Spring-Batch 2.1.5 and Spring 3.0.2.

    Thanks in advance.


  • #2
    Reported as bug


    • #3
      You can configure the writers with transactional=false. See