You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by "apm1467 (via GitHub)" <gi...@apache.org> on 2026/08/25 13:09:18 UTC

[I] TreeCache.iterator() throws NoSuchElementException after a parent node's last child is deleted [curator]

apm1467 opened a new issue, #1302:
URL: https://github.com/apache/curator/issues/1302

   Hi folks,
   
   We hit a bug in the latest version of Curator's `TreeCache::iterator` implementation. I will describe the bug here and submit a PR to fix it.
   
   If a user starts a TreeCache on a parent path that has children, and later every child of some cached node is deleted, `TreeCache.iterator()` throws `NoSuchElementException` instead of walking the remaining live nodes. That includes the cache root having all of its children deleted, and also a nested node having all of its children deleted. 
   
   A parent that never had children is OK (its children map stays null). The bug only appears after a node had children and then lost the last one. TreeCache keeps a non-null empty children map in that case, and the iterator tries to descend into it. Callers then cannot iterate the remaining live nodes until a new child is added or the cache is recreated. 
   
   Even though TreeCache itself is deprecated, this issue matters because `CuratorCache` falls back to `TreeCache` on a ZooKeeper version that does not support persistent watches. We hit this issue when using `CuratorCache::stream` on ZooKeeper 3.5.9.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@curator.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org