findAndVerifyWindowGrace() recurses over parent GraphNodes without a visited accumulator. Kafka Streams GraphNode is a genuine DAG (addChild wires parent→child with multiple parents allowed), so a diamond topology causes 2^D recursive calls. Fix: thread an IdentityHashMap<GraphNode,Long> memo through recursion; memoize on first visit, return cached result on revisit. 8/8 unit tests PASS; D=10 defect count=3071 vs patched O(N). Diamond-recursion CLEAN markers added for: flink, neo4j, janusgraph, tinkerpop, dgraph, zookeeper, storm, ant, gradle, graal, eclipse-jdt, exposed, intellij, kotlin, scala3, hibernate-0007 (prior session work now committed).
20 lines
661 B
Markdown
20 lines
661 B
Markdown
# zookeeper — diamond recursion CWE-407 scan: CLEAN
|
|
|
|
## Scan date: 2026-03-29
|
|
|
|
## Method scanned
|
|
|
|
`SnapshotRecursiveSummary.printZnode()` — recursive ZNode tree walk.
|
|
|
|
## Finding
|
|
|
|
ZooKeeper's data model is a strict hierarchical namespace (a tree, not a DAG). A
|
|
ZNode path is unique; no ZNode can appear under two different parent paths.
|
|
`DataNode.children` is a `Set<String>` of relative child names, and `DataTree` is
|
|
keyed by full path (`ConcurrentHashMap<String, DataNode>`). Diamond topology is
|
|
impossible by construction.
|
|
|
|
`printZnode` recursion is therefore O(N) where N is the number of ZNodes, with no
|
|
risk of exponential blowup.
|
|
|
|
## Verdict: CLEAN
|