userhimanshuverma opened a new pull request, #16440:
URL: https://github.com/apache/pinot/pull/16440

   #### **Issue**
   
   When browsing ZooKeeper nodes via the Pinot Controller UI (`Zookeeper 
Browser` tab), the UI crashes with the following error in the console:
   
   Related to #14216
   
   
   ```
   Uncaught (in promise) TypeError: Cannot read properties of null (reading 
'numChildren')
   ```
   
   This issue occurs when `currentNodeListStat[pathName]` is `null` or 
`undefined`, which can happen for certain ZNodes that exist but don’t have 
associated stat metadata (e.g., if there was a permission issue or deletion in 
progress).
   
   This results in a **blank screen** and an unusable UI in certain scenarios. 
Screenshots showing the behavior:
   
   * Working cluster shows a warning for `null` nodes:
     ![Cluster 1 - Warning for 
null](attachment:67fbc533-6e0e-4303-afcd-6be8b0c50c6d.png)
   
   * Failing cluster crashes on the same condition:
     ![Cluster 2 - Blank 
screen](attachment:96b06541-650e-4ea9-88fc-701095faf32c.png)
   
   ---
   
   #### **Root Cause**
   
   The existing logic assumes all `currentNodeListStat[pathName]` values are 
valid objects, and directly accesses `numChildren`. However, in real-world 
deployments, `null` values can be returned by ZooKeeper API due to inconsistent 
state or authorization limitations.
   
   ---
   
   #### **Fix**
   
   Updated the `getZookeeperData` function in `PinotMethodUtils.ts` to:
   
   * Check if `currentNodeListStat[pathName]` is `null` or `undefined`
   * Gracefully skip such nodes while logging a warning for visibility
   * Avoids UI crashes and ensures the rest of the node tree loads properly
   
   **Updated code snippet:**
   
   ```js
   pathNames.forEach((pathName) => {
     const nodeStat = currentNodeListStat[pathName];
   
     // Skip if nodeStat is null or undefined
     if (!nodeStat) {
       console.warn(`Skipping null node for path: ${pathName}`);
       return;
     }
   
     newTreeData[0].child.push({
       nodeId: `${counter++}`,
       label: pathName,
       fullPath: path === '/' ? path + pathName : `${path}/${pathName}`,
       child: [],
       isLeafNode: nodeStat.numChildren === 0,
       hasChildRendered: false
     });
   });
   ```
   
   ---
   
   #### **Impact**
   
   * Prevents UI from crashing on malformed or permission-limited ZooKeeper 
nodes
   * Allows continued navigation of valid nodes
   * Adds debug logging for `null` node cases to aid further troubleshooting
   
   #### **Issue Screenshot**
   <img width="1512" height="903" alt="image" 
src="https://github.com/user-attachments/assets/40e505ba-78fb-4674-ab56-a9583939745f";
 />
   
   #### **After Fix Screenshot**
   <img width="1512" height="904" alt="image" 
src="https://github.com/user-attachments/assets/15394423-d61e-41d6-b3a4-f8a9a505fa6a";
 />
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to