apache/dolphinscheduler · error · RegistryException

zookeeper get data error

Error message

zookeeper get data error

What it means

ZookeeperRegistry.get() reads the data of a ZNode via Curator's client.getData().forPath(key) and wraps any exception in a RegistryException with the generic message 'zookeeper get data error'. It is thrown for connectivity problems, missing nodes (NoNode), and ACL/authorization failures alike — the actual KeeperException is only available as the cause.

Source

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

    @Override
    public void subscribe(final String path, final SubscribeListener listener) {
        final TreeCache treeCache = treeCacheMap.computeIfAbsent(path, $ -> new TreeCache(client, path));
        treeCache.getListenable().addListener(new ZookeeperTreeCacheListenerAdapter(path, listener));
        try {
            treeCache.start();
        } catch (Exception e) {
            treeCacheMap.remove(path);
            throw new RegistryException("Failed to subscribe listener for key: " + path, e);
        }
    }

    @Override
    public String get(String key) {
        try {
            return new String(client.getData().forPath(key), StandardCharsets.UTF_8);
        } catch (Exception e) {
            throw new RegistryException("zookeeper get data error", e);
        }
    }

    @Override
    public boolean exists(String key) {
        try {
            return null != client.checkExists().forPath(key);
        } catch (Exception e) {
            throw new RegistryException("zookeeper check key is existed error", e);
        }
    }

    @Override
    public void put(String key, String value, boolean deleteOnDisconnect) {
        final CreateMode mode = deleteOnDisconnect ? CreateMode.EPHEMERAL : CreateMode.PERSISTENT;

        try {
            client.create()

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Call registry.exists(key) before get() to handle the missing-node case gracefully
  2. Check the cause KeeperException code: NoNode means the key is gone (handle as absent), CONNECTIONLOSS/SESSIONEXPIRED means retry after session recovery
  3. Verify ZooKeeper connectivity and registry.zookeeper.connect-string configuration
  4. Confirm reader and writer build the same key path (same prefix, no typo)
  5. Check znode ACLs allow the client to read

Example fix

// before
String value = registry.get("/process/" + id);
// after
String value = registry.exists("/process/" + id) ? registry.get("/process/" + id) : null;
Defensive patterns

Strategy: try-catch

Validate before calling

// guard against missing key
if (!registry.exists(key)) { return null; }

Try / catch

try {
    return registry.get(key);
} catch (RegistryException e) {
    if (e.getCause() instanceof KeeperException.NoNodeException) {
        return null; // treat as absent
    }
    throw e; // connectivity/ACL problems are real failures
}

Prevention

When it happens

Trigger: Calling get(key) when the key does not exist in ZooKeeper (KeeperException.NoNode), when the session has expired or connection is lost, when the path is malformed (empty/relative path), or when ACLs deny read access.

Common situations: Reading a process/task state node that another component already deleted (race with delete()); ZooKeeper restarted or unreachable so the client has no live session; key typo or path-prefix mismatch between writer and reader components; permissions changed on the znode.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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