{"record":{"id":"e77bd65cec1e0de0","repo":"apache/dolphinscheduler","slug":"acquire-lock-s-error","errorCode":null,"errorMessage":"Acquire lock: %s error","messagePattern":"Acquire 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/JdbcRegistry.java","lineNumber":195,"sourceCode":"\n    @Override\n    public boolean exists(String key) {\n        try {\n            return jdbcRegistryClient.existJdbcRegistryDataKey(key);\n        } catch (Exception e) {\n            throw new RegistryException(String.format(\"Check key: %s exist error\", key), e);\n        }\n    }\n\n    @Override\n    public boolean acquireLock(String key) {\n        try {\n            jdbcRegistryClient.acquireJdbcRegistryLock(key);\n            return true;\n        } catch (RegistryException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new RegistryException(String.format(\"Acquire lock: %s error\", key), e);\n        }\n    }\n\n    @Override\n    public boolean acquireLock(String key, long timeout) {\n        try {\n            return jdbcRegistryClient.acquireJdbcRegistryLock(key, timeout);\n        } catch (RegistryException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new RegistryException(String.format(\"Acquire lock: %s error\", key), e);\n        }\n    }\n\n    @Override\n    public boolean releaseLock(String key) {\n        jdbcRegistryClient.releaseJdbcRegistryLock(key);\n        return true;","sourceCodeStart":177,"sourceCodeEnd":213,"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/JdbcRegistry.java#L177-L213","documentation":"Thrown by JdbcRegistry.acquireLock(key) when acquiring a non-blocking lock in the registry DB fails unexpectedly. RegistryExceptions raised by the client are rethrown as-is; all other exceptions are wrapped with the lock key.","triggerScenarios":"Calling registry.acquireLock(key) when the underlying DB lock row insert/update fails: connection error, constraint conflict, or transaction failure.","commonSituations":"DB outage, two nodes contending for the same lock with connection issues, expired/leaked lock rows blocking acquisition paths.","solutions":["Inspect the cause exception for the real failure","Verify DB connectivity","Check for stale lock rows in the lock table and clean them up","Use the timeout variant acquireLock(key, timeout) to bound waiting"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify lock table reachable: try (Connection c = dataSource.getConnection()) { }","typeGuard":null,"tryCatchPattern":"try { got = registry.acquireLock(key); } catch (RegistryException e) { log.error(\"lock {} failed: {}\", key, e.getCause(), e); got = false; }","preventionTips":["Prefer the timeout variant to bound waiting","Periodically clean stale lock rows","Monitor DB connection health"],"tags":["registry","jdbc","lock"],"backgroundTag":"database-write-failed","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}