{"record":{"id":"87862f2edc479d61","repo":"flowable/flowable-engine","slug":"exception-during-resetting-expired-jobs-for-en","errorCode":null,"errorMessage":"exception during resetting expired jobs: {} for engine {}","messagePattern":"exception during resetting expired jobs: (.+?) for engine (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/ResetExpiredJobsRunnable.java","lineNumber":131,"sourceCode":"                if (!expiredJobIds.isEmpty()) {\n                    asyncExecutor.getJobServiceConfiguration().getCommandExecutor().execute(\n                            new ResetExpiredJobsCmd(expiredJobIds, jobEntityManager, jobServiceConfiguration));\n\n                } else {\n                    hasExpiredJobs = false;\n\n                }\n\n            } catch (Throwable e) {\n\n                // If an optimistic locking exception happens, we continue resetting.\n                // If another exception happens, we return the method which will trigger a sleep.\n\n                if (e instanceof FlowableOptimisticLockingException) {\n                    LOGGER.debug(\"Optimistic lock exception while resetting locked jobs for engine {}\", asyncExecutor.getJobServiceConfiguration().getEngineName(), e);\n\n                } else {\n                    LOGGER.warn(\"exception during resetting expired jobs: {} for engine {}\", e.getMessage(),\n                                    asyncExecutor.getJobServiceConfiguration().getEngineName(), e);\n                    hasExpiredJobs = false; // will stop the loop\n\n                }\n            }\n\n        }\n\n    }\n\n    public void stop() {\n        synchronized (MONITOR) {\n            isInterrupted = true;\n            if (isWaiting.compareAndSet(true, false)) {\n                MONITOR.notifyAll();\n            }\n        }\n    }","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/ResetExpiredJobsRunnable.java#L113-L149","documentation":"WARN log from ResetExpiredJobsRunnable when resetting expired (locked) async jobs fails with an exception other than FlowableOptimisticLockingException. Optimistic-lock failures are logged at debug (expected in clusters); anything else stops the reset loop (hasExpiredJobs=false) and the thread sleeps before the next cycle.","triggerScenarios":"Non-optimistic-lock Throwable during the ResetExpiredJobsCmd update of expired jobs: DB connection loss, SQL errors, deadlocks while moving lock ownership of expired jobs.","commonSituations":"Database failover while the reset thread runs; connection pool exhaustion; schema mismatch of ACT_RU_JOB lock columns after upgrades.","solutions":["Check the chained exception for the DB-level root cause","Verify database connectivity and pool health during the reset window","Confirm ACT_RU_JOB schema (LOCK_OWNER_/LOCK_EXP_TIME_ columns) matches the engine version","The loop self-recovers on the next cycle; if it recurs, investigate DB load/locks causing deadlocks"],"exampleFix":"// before: pool too small under load causing timeouts during reset\nmaximumPoolSize=5\n// after\nmaximumPoolSize=20; connectionTimeout=30000","handlingStrategy":"retry","validationCode":"// pool health check before engine start\ntry (Connection c = dataSource.getConnection()) { if (!c.isValid(5)) throw new SQLException(\"unhealthy connection\"); }","typeGuard":null,"tryCatchPattern":"try {\n    resetExpiredJobs();\n} catch (FlowableOptimisticLockingException e) {\n    log.debug(\"expected in cluster\", e); // benign\n} catch (Throwable e) {\n    log.warn(\"reset failed; will retry after sleep\", e);\n}","preventionTips":["Size the connection pool for all executor threads","Keep ACT_RU_JOB schema current","Treat optimistic-lock resets as normal cluster noise"],"tags":["flowable","async-executor","expired-jobs","database","job-reset"],"backgroundTag":"database-write-failed","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}