{"record":{"id":"0d847f84abd75eb7","repo":"apache/druid","slug":"unannouncing-non-empty-path-s-0d847f","errorCode":null,"errorMessage":"Unannouncing non-empty path[%s]","messagePattern":"Unannouncing non-empty path\\[(.+?)\\]","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/src/main/java/org/apache/druid/curator/announcement/PathChildrenAnnouncer.java","lineNumber":429,"sourceCode":"    final String parentPath = pathAndNode.getPath();\n\n    final ConcurrentMap<String, byte[]> subPaths = announcements.get(parentPath);\n\n    if (subPaths == null || subPaths.remove(pathAndNode.getNode()) == null) {\n      log.debug(\"Path[%s] not announced, cannot unannounce.\", path);\n      return;\n    }\n    log.info(\"Unannouncing [%s]\", path);\n\n    try {\n      CuratorOp deleteOp = curator.transactionOp().delete().forPath(path);\n      curator.transaction().forOperations(deleteOp);\n    }\n    catch (KeeperException.NoNodeException e) {\n      log.info(\"Unannounced node[%s] that does not exist.\", path);\n    }\n    catch (KeeperException.NotEmptyException e) {\n      log.warn(\"Unannouncing non-empty path[%s]\", path);\n    }\n    catch (Exception e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private void startCache(PathChildrenCache cache)\n  {\n    try {\n      cache.start();\n    }\n    catch (Throwable e) {\n      throw CloseableUtils.closeAndWrapInCatch(e, cache);\n    }\n  }\n\n  private void createPath(String parentPath, boolean removeParentsIfCreated)\n  {","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/curator/announcement/PathChildrenAnnouncer.java#L411-L447","documentation":"PathChildrenAnnouncer.unannounce performs a transactional delete of the announced path and its parent. KeeperException.NotEmptyException means the parent znode could not be removed because it still contains children (other announced children under the same parent). The class deliberately logs a warning rather than throwing since removing non-empty parents is expected when multiple children share a parent.","triggerScenarios":"Calling stop() (which invokes unannounce) on a PathChildrenAnnouncer whose parent path still holds child znodes — e.g. several children announced under one parent and only one child announcer is being stopped.","commonSituations":"Multiple announcements under a common directory (coordinator/overlord service discovery paths), incomplete prior shutdowns leaving orphan children, or overlapping announcers from different Druid processes sharing a parent.","solutions":["Verify that sibling child znodes under the parent are legitimately still announced; if so, the warning is expected and can be ignored.","Stop all child announcers before stopping the shared parent announcer so the parent delete succeeds.","Inspect the path with the ZK CLI to identify which children remain and who created them.","Clean up stale children left by crashed processes if no live process owns them."],"exampleFix":"// before\nchildAnnouncer.stop(); // only one child stopped; parent still has others\n// after\nchildAnnouncer1.stop();\nchildAnnouncer2.stop();\nparentAnnouncer.stop(); // parent now empty and deletable","handlingStrategy":"validation","validationCode":"// confirm no live siblings remain under the parent before stopping the last announcer\nList<String> children = zooKeeper.getChildren(parentPath, false);\nif (children.size() > 1) { /* expected NotEmpty warning */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Stop all child announcers sharing a parent before stopping the parent announcer.","Treat this warning as expected whenever siblings are still announced.","Clean up stale children from crashed processes during maintenance."],"tags":["zookeeper","curator","cleanup","announcement"],"backgroundTag":"resource-not-found","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}