SAP Knowledge Base Article - Preview

3141869 - Task cannot be triggered due to failed to lock task

Symptom

You notice that your task cannot be triggered and in the log the following exception exist:

java.lang.IllegalStateException: Failed to lock task #[task_id].
        at de.hybris.platform.task.impl.TaskDAO.lock(TaskDAO.java:253)
        at de.hybris.platform.task.impl.DefaultTaskService.processTask(DefaultTaskService.java:1461)
        at de.hybris.platform.task.impl.DefaultTaskService.process(DefaultTaskService.java:1401)
        at de.hybris.platform.task.impl.DefaultTaskService.processInTenant(DefaultTaskService.java:1370)
        at de.hybris.platform.task.impl.DefaultTaskService$5.run(DefaultTaskService.java:1232)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
        at de.hybris.platform.core.threadregistry.RegistrableThread.internalRun(RegistrableThread.java:141)
        at de.hybris.platform.core.threadregistry.RegistrableThread.run(RegistrableThread.java:131)
Caused by: org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [UPDATE taskconditions SET p_consumed = ? WHERE p_task = ?]; Cannot insert duplicate key row in object 'dbo.taskconditions' with unique index 'Cond_idx_951'. The duplicate key value is ([id], 1).; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert duplicate key row in object 'dbo.taskconditions' with unique index 'Cond_idx_951'. The duplicate key value is ([id], 1).
        at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:243)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
        at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1443)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
        at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:862)
        at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:917)
        at de.hybris.platform.task.impl.TaskDAO.update(TaskDAO.java:457)
        at de.hybris.platform.task.impl.TaskDAO.lockInternal(TaskDAO.java:298)
        at de.hybris.platform.task.impl.TaskDAO$9.execute(TaskDAO.java:279)
        at de.hybris.platform.task.impl.TaskDAO$9.execute(TaskDAO.java:1)
        at de.hybris.platform.tx.Transaction.execute(Transaction.java:1181)
        at de.hybris.platform.tx.Transaction.execute(Transaction.java:1149)
        at de.hybris.platform.task.impl.TaskDAO.lockWithTxRequired(TaskDAO.java:274)
        at de.hybris.platform.task.impl.TaskDAO.lock(TaskDAO.java:249)
        ... 9 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert duplicate key row in object 'dbo.taskconditions' with unique index 'Cond_idx_951'. The duplicate key value is ([id], 1).
Caused by: org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [UPDATE taskconditions SET p_consumed = ? WHERE p_task = ?]; Cannot insert duplicate key row in object 'dbo.taskconditions' with unique index 'Cond_idx_951'. The duplicate key value is ([id], 1).; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert duplicate key row in object 'dbo.taskconditions' with unique index 'Cond_idx_951'. The duplicate key value is ([id], 1).
        at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:243)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
        at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1443)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
        at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:862)
        at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:917)
        at de.hybris.platform.task.impl.TaskDAO.update(TaskDAO.java:457)
        at de.hybris.platform.task.impl.TaskDAO.lockInternal(TaskDAO.java:298)
        at de.hybris.platform.task.impl.TaskDAO$9.execute(TaskDAO.java:279)
        at de.hybris.platform.task.impl.TaskDAO$9.execute(TaskDAO.java:1)
        at de.hybris.platform.tx.Transaction.execute(Transaction.java:1181)
        at de.hybris.platform.tx.Transaction.execute(Transaction.java:1149)
        at de.hybris.platform.task.impl.TaskDAO.lockWithTxRequired(TaskDAO.java:274)
        at de.hybris.platform.task.impl.TaskDAO.lock(TaskDAO.java:249)
        ... 9 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert duplicate key row in object 'dbo.taskconditions' with unique index 'Cond_idx_951'. The duplicate key value is ([id], 1).
        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1632)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:600)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:522)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7225)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:3053)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:247)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:222)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:471)
        at de.hybris.platform.jdbcwrapper.interceptor.PreparedStatementWithJDBCInterceptor.lambda$5(PreparedStatementWithJDBCInterceptor.java:86)
        at de.hybris.platform.jdbcwrapper.interceptor.recover.SQLRecoverableExceptionHandler.passThrough(SQLRecoverableExceptionHandler.java:101)
        at de.hybris.platform.jdbcwrapper.interceptor.recover.SQLRecoverableExceptionHandler.get(SQLRecoverableExceptionHandler.java:59)
        at de.hybris.platform.jdbcwrapper.interceptor.JDBCInterceptor.get(JDBCInterceptor.java:69)
        at de.hybris.platform.jdbcwrapper.interceptor.PreparedStatementWithJDBCInterceptor.executeUpdate(PreparedStatementWithJDBCInterceptor.java:86)
        at de.hybris.platform.jdbcwrapper.PreparedStatementImpl.executeUpdate(PreparedStatementImpl.java:317)
        at org.springframework.jdbc.core.JdbcTemplate.lambda$update$0(JdbcTemplate.java:867)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617)
        ... 19 more
java.lang.IllegalStateException: Failed to lock task #[task_id].
        at de.hybris.platform.task.impl.TaskDAO.lock(TaskDAO.java:253)
        at de.hybris.platform.task.impl.DefaultTaskService.processTask(DefaultTaskService.java:1461)
        at de.hybris.platform.task.impl.DefaultTaskService.process(DefaultTaskService.java:1401)
        at de.hybris.platform.task.impl.DefaultTaskService.processInTenant(DefaultTaskService.java:1370)
        at de.hybris.platform.task.impl.DefaultTaskService$5.run(DefaultTaskService.java:1232)


Read more...

Environment

SAP Commerce

Product

SAP Commerce all versions

Keywords

KBA , CEC-COM-CPS-TSK , Cronjob - Impex - Task Engine , Known Error

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.