Copilot commented on code in PR #7840:
URL: https://github.com/apache/kyuubi/pull/7840#discussion_r4469765223


##########
kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClient.scala:
##########
@@ -401,11 +407,12 @@ class ZookeeperDiscoveryClient(conf: KyuubiConf) extends 
DiscoveryClient {
   }
 
   private def watchNode(): Unit = {
-    if (zkClient.checkExists
-        
.usingWatcher(watcher.asInstanceOf[Watcher]).forPath(serviceNode.getActualPath) 
== null) {
-      // No node exists, throw exception
-      throw new KyuubiException(s"Unable to create znode for this Kyuubi " +
-        s"instance[${watcher.instance}] on ZooKeeper.")
+    // A queued NodeDataChanged event can arrive after deregistration.
+    Option(serviceNode).flatMap(node => Option(node.getActualPath)).foreach { 
path =>

Review Comment:
   If a queued `NodeDataChanged` callback runs after `deregisterService()` 
clears `serviceNode` but before `node.close()` deletes the znode, this guard 
skips rearming the one-shot watch. The deletion then cannot trigger 
`stopGracefully()`, so `KyuubiServiceDiscovery.stop()` can still wait 
indefinitely on `gracefulShutdownLatch.await()`. Preserve deletion observation 
or signal graceful shutdown independently, and add a regression for this 
ordering; the current test injects `NodeDeleted` directly and cannot detect the 
lost notification.



-- 
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