apache/dolphinscheduler · error · RegistryException
zookeeper get children error
Error message
zookeeper get children error
What it means
ZookeeperRegistry.children() lists the child znodes of a key via client.getChildren().forPath(key), sorts them in reverse order, and wraps any failure in a RegistryException 'zookeeper get children error'. A missing parent key (NoNode) is the most common cause; connection loss and ACL denial also surface here.
Source
Thrown at dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java:193
try {
client.create()
.orSetData()
.creatingParentsIfNeeded()
.withMode(mode)
.forPath(key, value.getBytes(StandardCharsets.UTF_8));
} catch (Exception e) {
throw new RegistryException("Failed to put registry key: " + key, e);
}
}
@Override
public List<String> children(String key) {
try {
List<String> result = client.getChildren().forPath(key);
result.sort(Comparator.reverseOrder());
return result;
} catch (Exception e) {
throw new RegistryException("zookeeper get children error", e);
}
}
@Override
public void delete(String nodePath) {
try {
client.delete()
.deletingChildrenIfNeeded()
.forPath(nodePath);
} catch (KeeperException.NoNodeException ignored) {
// Is already deleted or does not exist
} catch (Exception e) {
throw new RegistryException("Failed to delete registry key: " + nodePath, e);
}
}
@Override
public boolean acquireLock(String key) {View on GitHub (pinned to 02eac45a1b)
Solutions
- Guard with registry.exists(key) before listing children, and treat a missing parent as an empty result
- Check the wrapped cause code: NoNode → create the parent or handle as empty list; CONNECTIONLOSS → retry after session recovery
- Verify both writer and reader use the same registry root/prefix configuration
- Confirm ACLs permit the client to list the parent znode
Example fix
// before
List<String> kids = registry.children("/tasks/" + groupId);
// after
List<String> kids = registry.exists("/tasks/" + groupId)
? registry.children("/tasks/" + groupId)
: Collections.emptyList(); Defensive patterns
Strategy: validation
Validate before calling
if (!registry.exists(key)) {
return Collections.emptyList(); // parent never created or concurrently deleted
}
List<String> children = registry.children(key); Try / catch
try {
return registry.children(key);
} catch (RegistryException e) {
if (e.getCause() instanceof KeeperException.NoNodeException) {
return Collections.emptyList();
}
throw e;
} Prevention
- Create parent znodes (persistent) before children are expected to exist
- Treat empty/missing parents as normal states in failover and cleanup paths
- Keep the registry root prefix consistent between components that create and enumerate nodes
- Retry children() on transient connection-loss causes rather than failing the whole listing
When it happens
Trigger: Calling children(key) when the key has no znode (KeeperException.NoNode), when the session is expired/unreachable, when ACLs deny listing children, or when the key is a malformed path.
Common situations: Enumerating tasks/masters under a parent path that was concurrently deleted (failover, cleanup job); querying before the parent was ever created; ZooKeeper unreachable during startup; path prefix mismatch after changing the registry root config.
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
- Failed to subscribe listener for key:
- zookeeper get data error
- zookeeper check key is existed error
- Failed to put registry key:
- Worker registry client start up error
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/30142249e5721b39.
Report an issue: GitHub.