{"record":{"id":"08246c873280414f","repo":"flowable/flowable-engine","slug":"exception-for-engine-during-async-job-acquisiti","errorCode":null,"errorMessage":"exception for engine {} during async job acquisition: {}","messagePattern":"exception for engine (.+?) during async job acquisition: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/AcquireAsyncJobsDueRunnable.java","lineNumber":220,"sourceCode":"        } catch (FlowableOptimisticLockingException optimisticLockingException) {\n\n            lifecycleListener.optimistLockingException(getEngineName(), asyncExecutor.getMaxAsyncJobsDuePerAcquisition());\n\n            if (globalAcquireLockEnabled) {\n                LOGGER.warn(\"Optimistic locking exception (using global acquire lock) for engine {}\", getEngineName(), optimisticLockingException);\n\n            } else {\n                LOGGER.debug(\n                    \"Optimistic locking exception during async job acquisition. If you have multiple async executors running against the same database, \" +\n                    \"this exception means that this thread tried to acquire a due async job, which already was acquired by another \" +\n                    \"async executor acquisition thread.This is expected behavior in a clustered environment. \" +\n                    \"You can ignore this message if you indeed have multiple async executor acquisition threads running against the same database. \" +\n                    \"For engine {}. Exception message: {}\",\n                        getEngineName(), optimisticLockingException.getMessage());\n\n            }\n        } catch (Throwable e) {\n            LOGGER.warn(\"exception for engine {} during async job acquisition: {}\", getEngineName(), e.getMessage(), e);\n        }\n\n        return asyncExecutor.getDefaultAsyncJobAcquireWaitTimeInMillis();\n    }\n\n    protected List<JobInfoEntity> offerJobs(List<? extends JobInfoEntity> acquiredJobs) {\n        List<JobInfoEntity> rejected = new ArrayList<>();\n        for (JobInfoEntity job : acquiredJobs) {\n            boolean jobSuccessFullyOffered = asyncExecutor.executeAsyncJob(job);\n            if (!jobSuccessFullyOffered) {\n                rejected.add(job);\n            }\n        }\n        return rejected;\n    }\n\n    public void stop() {\n        synchronized (MONITOR) {","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/AcquireAsyncJobsDueRunnable.java#L202-L238","documentation":"Generic WARN log from the async job acquisition thread: any Throwable thrown during acquireAndExecuteJobs that is not an optimistic-locking exception is caught and logged here with the engine name and message. It signals the acquisition cycle failed (e.g. DB error) and the thread will sleep before retrying.","triggerScenarios":"Any non-optimistic-lock Throwable during job acquisition: database connectivity loss, SQL errors, deadlock, command execution failure inside AcquireAsyncJobsDueCmd.","commonSituations":"Transient DB outages or failovers in clustered environments; connection pool exhaustion; schema mismatch after a Flowable version upgrade (missing job tables/columns).","solutions":["Read the chained stack trace in the log to identify the root cause (usually a SQL/DB error)","Verify database connectivity and connection pool health","Check that the ACT_RU_JOB schema matches your Flowable version (run the DB upgrade scripts)","If persistent, inspect the failing command/query and any custom session factories"],"exampleFix":"// before: acquisition thread repeatedly fails on dead pool connections\n// after: validate connections and cap retries\ndataSource.setDefaultTestOnBorrow(true);\n// e.g. Hikari: hikariConfig.setConnectionTestQuery(\"SELECT 1\");","handlingStrategy":"try-catch","validationCode":"// health-check DB before starting the engine\ntry (Connection c = dataSource.getConnection()) { c.isValid(5); } catch (SQLException e) { fail(\"database unreachable\"); }","typeGuard":null,"tryCatchPattern":"try {\n    executor.start();\n} catch (DataAccessException | SQLException e) {\n    log.error(\"job acquisition failed due to DB issue\", e);\n    // alert / backoff / retry cycle\n}","preventionTips":["Monitor database connectivity and pool saturation","Keep schema in sync with Flowable version via upgrade scripts","Add alerts on repeated acquisition-failure log lines","Use validated/test-on-borrow pooled connections"],"tags":["flowable","async-executor","job-acquisition","database","unexpected-exception"],"backgroundTag":"database-query-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"}