org.springframework.batch.core.step.FatalStepExecutionException: JobRepository failure forcing exit with unknown status

Spring JIRA | ak | 3 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Need to synchronize the stepExecution in org.springframework.batch.core.repository.dao.JdbcExecutionContextDao in the method updateExecutionContext(final StepExecution stepExecution), in order to prevent concurrency failures if two threads are trying to update the same step execution context record. It appears this is already done in JdbcStepExecutionDao.updateStepExecution at line 162: // Attempt to prevent concurrent modification errors by blocking here if // someone is already trying to do it. synchronized (stepExecution) { The error we are getting when our multithreaded tasklet is processing is: "org.springframework.batch.core.step.FatalStepExecutionException: JobRepository failure forcing exit with unknown status at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:441) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264) at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76) at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:258) at java.lang.Thread.run(Thread.java:679) Caused by: org.springframework.dao.ConcurrencyFailureException: PreparedStatementCallback; SQL [UPDATE BATCH_STEP_EXECUTION_CONTEXT SET SHORT_CONTEXT = ?, SERIALIZED_CONTEXT = ? WHERE STEP_EXECUTION_ID = ?]; [Teradata Database] [TeraJDBC 14.00.00.37] [Error 2631] [SQLState 40001] Transaction ABORTed due to deadlock.; nested exception is com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata Database] [TeraJDBC 14.00.00.37] [Error 2631] [SQLState 40001] Transaction ABORTed due to deadlock. at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:110) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:605) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:818) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:874) at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.persistSerializedContext(JdbcExecutionContextDao.java:193) at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.updateExecutionContext(JdbcExecutionContextDao.java:136) at org.springframework.batch.core.repository.support.SimpleJobRepository.updateExecutionContext(SimpleJobRepository.java:184) at sun.reflect.GeneratedMethodAccessor381.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccesso"

    Spring JIRA | 3 years ago | ak
    org.springframework.batch.core.step.FatalStepExecutionException: JobRepository failure forcing exit with unknown status
  2. 0

    Need to synchronize the stepExecution in org.springframework.batch.core.repository.dao.JdbcExecutionContextDao in the method updateExecutionContext(final StepExecution stepExecution), in order to prevent concurrency failures if two threads are trying to update the same step execution context record. It appears this is already done in JdbcStepExecutionDao.updateStepExecution at line 162: // Attempt to prevent concurrent modification errors by blocking here if // someone is already trying to do it. synchronized (stepExecution) { The error we are getting when our multithreaded tasklet is processing is: "org.springframework.batch.core.step.FatalStepExecutionException: JobRepository failure forcing exit with unknown status at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:441) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264) at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76) at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:258) at java.lang.Thread.run(Thread.java:679) Caused by: org.springframework.dao.ConcurrencyFailureException: PreparedStatementCallback; SQL [UPDATE BATCH_STEP_EXECUTION_CONTEXT SET SHORT_CONTEXT = ?, SERIALIZED_CONTEXT = ? WHERE STEP_EXECUTION_ID = ?]; [Teradata Database] [TeraJDBC 14.00.00.37] [Error 2631] [SQLState 40001] Transaction ABORTed due to deadlock.; nested exception is com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata Database] [TeraJDBC 14.00.00.37] [Error 2631] [SQLState 40001] Transaction ABORTed due to deadlock. at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:110) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:605) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:818) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:874) at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.persistSerializedContext(JdbcExecutionContextDao.java:193) at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.updateExecutionContext(JdbcExecutionContextDao.java:136) at org.springframework.batch.core.repository.support.SimpleJobRepository.updateExecutionContext(SimpleJobRepository.java:184) at sun.reflect.GeneratedMethodAccessor381.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccesso"

    Spring JIRA | 3 years ago | ak
    org.springframework.batch.core.step.FatalStepExecutionException: JobRepository failure forcing exit with unknown status

    Root Cause Analysis

    1. org.springframework.dao.ConcurrencyFailureException

      PreparedStatementCallback; SQL [UPDATE BATCH_STEP_EXECUTION_CONTEXT SET SHORT_CONTEXT = ?, SERIALIZED_CONTEXT = ? WHERE STEP_EXECUTION_ID = ?]; [Teradata Database] [TeraJDBC 14.00.00.37] [Error 2631] [SQLState 40001] Transaction ABORTed due to deadlock.; nested exception is com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata Database] [TeraJDBC 14.00.00.37] [Error 2631] [SQLState 40001] Transaction ABORTed due to deadlock.

      at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate()
    2. Spring Framework
      JdbcTemplate.update
      1. org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:110)
      2. org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
      3. org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
      4. org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
      5. org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:605)
      6. org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:818)
      7. org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:874)
      7 frames
    3. Spring Batch Core
      SimpleJobRepository.updateExecutionContext
      1. org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.persistSerializedContext(JdbcExecutionContextDao.java:193)
      2. org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.updateExecutionContext(JdbcExecutionContextDao.java:136)
      3. org.springframework.batch.core.repository.support.SimpleJobRepository.updateExecutionContext(SimpleJobRepository.java:184)
      3 frames
    4. Java RT
      GeneratedMethodAccessor381.invoke
      1. sun.reflect.GeneratedMethodAccessor381.invoke(Unknown Source)
      1 frame