diff --git a/core/src/main/java/com/netflix/conductor/core/execution/AsyncSystemTaskExecutor.java b/core/src/main/java/com/netflix/conductor/core/execution/AsyncSystemTaskExecutor.java index ada069a1e5..dd7975425f 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/AsyncSystemTaskExecutor.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/AsyncSystemTaskExecutor.java @@ -64,6 +64,18 @@ public void execute(WorkflowSystemTask systemTask, String taskId) { TaskModel task = loadTaskQuietly(taskId); if (task == null) { LOGGER.error("TaskId: {} could not be found while executing {}", taskId, systemTask); + try { + LOGGER.debug( + "Cleaning up dead task from queue message: taskQueue={}, taskId={}", + systemTask.getTaskType(), + taskId); + queueDAO.remove(systemTask.getTaskType(), taskId); + } catch (Exception e) { + LOGGER.error( + "Failed to remove dead task from queue message: taskQueue={}, taskId={}", + systemTask.getTaskType(), + taskId); + } return; }