apache/dolphinscheduler · error · RegistryException

zookeeper get lock: %s error

Error message

zookeeper get lock: %s error

What it means

Wrapper thrown in ZookeeperRegistry.acquireLock: when Curator's InterProcessMutex.acquire fails — connection loss, session expired, or interrupt while waiting for the distributed mutex on the key — the code attempts to release the partially-acquired mutex and throws a RegistryException naming the lock key. It indicates the thread did NOT obtain the lock.

Source

Thrown at dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java:229

    public boolean acquireLock(String key) {
        Map<String, InterProcessMutex> processMutexMap = threadLocalLockMap.get();
        if (null == processMutexMap) {
            processMutexMap = new HashMap<>();
            threadLocalLockMap.set(processMutexMap);
        }
        InterProcessMutex interProcessMutex = null;
        try {
            interProcessMutex =
                    Optional.ofNullable(processMutexMap.get(key)).orElse(new InterProcessMutex(client, key));
            interProcessMutex.acquire();
            processMutexMap.put(key, interProcessMutex);
            return true;
        } catch (Exception e) {
            try {
                if (interProcessMutex != null) {
                    interProcessMutex.release();
                }
                throw new RegistryException(String.format("zookeeper get lock: %s error", key), e);
            } catch (Exception exception) {
                throw new RegistryException(String.format("zookeeper get lock: %s error", key), e);
            }
        }
    }

    @Override
    public boolean acquireLock(String key, long timeout) {
        Map<String, InterProcessMutex> processMutexMap = threadLocalLockMap.get();
        if (null == processMutexMap) {
            processMutexMap = new HashMap<>();
            threadLocalLockMap.set(processMutexMap);
        }
        InterProcessMutex interProcessMutex = null;
        try {
            interProcessMutex =
                    Optional.ofNullable(processMutexMap.get(key)).orElse(new InterProcessMutex(client, key));
            if (interProcessMutex.acquire(timeout, MILLISECONDS)) {

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Check ZooKeeper health/session stability if the cause is ConnectionLoss or SessionExpired
  2. If the cause is InterruptedException, review who interrupted the waiting thread
  3. Retry acquisition; verify no stale lock holders block the path
  4. Confirm the lock path scheme matches what other processes use
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java:229 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/497878925a3233f6. Report an issue: GitHub.