TreeCache.iterator() throws NoSuchElementException after a parent node's last child is deleted
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- java
- Domain
- distributed-systems
Research direction
Start by reproducing the failure through TreeCache.iterator(), including the case where the cache root or a nested node loses its last child; also check the CuratorCache.stream() fallback described in the issue. Inspect how iteration handles a non-null empty children map, and consider the issue done when remaining live nodes can be traversed without NoSuchElementException.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Java
- Stars
- 3.2k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/curator
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
Upgrade to Jackson 3 Open
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100