{"record":{"id":"9d81783e5ab8f79f","repo":"apache/dolphinscheduler","slug":"acquire-the-lock-error","errorCode":null,"errorMessage":"Acquire the lock:  error","messagePattern":"Acquire the lock:  error","errorType":"exception","errorClass":"RegistryException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/server/JdbcRegistryServer.java","lineNumber":235,"sourceCode":"        return jdbcRegistryDataManager.listJdbcRegistryDataChildren(key);\n    }\n\n    @Override\n    public void putJdbcRegistryData(Long clientId, String key, String value, DataType dataType) {\n        jdbcRegistryDataManager.putJdbcRegistryData(clientId, key, value, dataType);\n    }\n\n    @Override\n    public void deleteJdbcRegistryDataByKey(String key) {\n        jdbcRegistryDataManager.deleteJdbcRegistryDataByKey(key);\n    }\n\n    @Override\n    public void acquireJdbcRegistryLock(Long clientId, String lockKey) {\n        try {\n            jdbcRegistryLockManager.acquireJdbcRegistryLock(clientId, lockKey);\n        } catch (Exception ex) {\n            throw new RegistryException(\"Acquire the lock: \" + lockKey + \" error\", ex);\n        }\n    }\n\n    @Override\n    public boolean acquireJdbcRegistryLock(Long clientId, String lockKey, long timeout) {\n        try {\n            return jdbcRegistryLockManager.acquireJdbcRegistryLock(clientId, lockKey, timeout);\n        } catch (Exception ex) {\n            throw new RegistryException(\"Acquire the lock: \" + lockKey + \" error\", ex);\n        }\n    }\n\n    @Override\n    public void releaseJdbcRegistryLock(Long clientId, String lockKey) {\n        try {\n            jdbcRegistryLockManager.releaseJdbcRegistryLock(clientId, lockKey);\n        } catch (Exception ex) {\n            throw new RegistryException(\"Release the lock: \" + lockKey + \" error\", ex);","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/server/JdbcRegistryServer.java#L217-L253","documentation":"JdbcRegistryServer.acquireJdbcRegistryLock (blocking variant) delegates to JdbcRegistryLockManager and wraps any exception in a RegistryException with message 'Acquire the lock: <lockKey> error'. Any underlying failure — DB errors, interrupt, lock-conflict exceptions — surfaces as this RegistryException with the original exception as the cause.","triggerScenarios":"Blocking acquireJdbcRegistryLock(clientId, lockKey) failing due to a database error inserting/selecting the lock row, thread interruption while waiting, or the lock manager throwing an internal exception.","commonSituations":"jdbc registry tables missing or unreachable (DB down/misconfigured), network flaps between the server and the metadata DB, deadlock/timeout contention when many nodes contend for the same lock key.","solutions":["Inspect the cause chain of the RegistryException for the root error (SQL/interrupt)","Verify the jdbc registry database connectivity and that its schema tables exist","Retry the acquire with backoff; if contention is high, use the timeout-based variant"],"exampleFix":"// before\nregistryClient.acquireJdbcRegistryLock(clientId, lockKey); // throws RegistryException on any failure\n// after\ntry {\n    registryClient.acquireJdbcRegistryLock(clientId, lockKey);\n} catch (RegistryException e) {\n    log.error(\"Lock acquire failed for {}: {}\", lockKey, e.getCause());\n    throw e;\n}","handlingStrategy":"retry","validationCode":"try (Connection c = dataSource.getConnection()) { /* verify DB reachable before lock ops */ }","typeGuard":null,"tryCatchPattern":"try { registryClient.acquireJdbcRegistryLock(clientId, lockKey); } catch (RegistryException e) { log.error(\"Lock acquire failed: {}\", e.getCause()); }","preventionTips":["Monitor jdbc registry DB health before lock-heavy workloads","Always log the cause chain of RegistryException","Prefer timeout-based acquire to avoid indefinite blocking"],"tags":["registry","distributed-lock","database"],"backgroundTag":"database-query-failed","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}