You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by rn...@apache.org on 2023/04/21 00:58:56 UTC

[kafka] branch 2.7 updated: KAFKA-14887: FinalizedFeatureChangeListener should not shut down when ZK session expires

This is an automated email from the ASF dual-hosted git repository.

rndgstn pushed a commit to branch 2.7
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/2.7 by this push:
     new f033a71ee56 KAFKA-14887: FinalizedFeatureChangeListener should not shut down when ZK session expires
f033a71ee56 is described below

commit f033a71ee5668915ccefb7a828e9d104b652810d
Author: Ron Dagostino <rn...@gmail.com>
AuthorDate: Wed Apr 19 19:45:26 2023 -0400

    KAFKA-14887: FinalizedFeatureChangeListener should not shut down when ZK session expires
    
    FinalizedFeatureChangeListener shuts the broker down when it encounters an issue trying to process feature change
    events. However, it does not distinguish between issues related to feature changes actually failing and other
    exceptions like ZooKeeper session expiration. This introduces the possibility that Zookeeper session expiration
    could cause the broker to shutdown, which is not intended. This patch updates the code to distinguish between
    these two types of exceptions. In the case of something like a ZK session expiration it logs a warning and continues.
    We shutdown the broker only for FeatureCacheUpdateException.
    
    Reviewers: Kamal Chandraprakash <ka...@gmail.com>, Christo Lolov <ch...@gmail.com>, Colin P. McCabe <cm...@apache.org>
---
 .../main/scala/kafka/server/FinalizedFeatureChangeListener.scala  | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/core/src/main/scala/kafka/server/FinalizedFeatureChangeListener.scala b/core/src/main/scala/kafka/server/FinalizedFeatureChangeListener.scala
index 40bce240d2a..1f064c66ec1 100644
--- a/core/src/main/scala/kafka/server/FinalizedFeatureChangeListener.scala
+++ b/core/src/main/scala/kafka/server/FinalizedFeatureChangeListener.scala
@@ -153,10 +153,12 @@ class FinalizedFeatureChangeListener(private val finalizedFeatureCache: Finalize
           // safe to ignore the exception if the thread is being shutdown. We raise the exception
           // here again, because, it is ignored by ShutdownableThread if it is shutting down.
           throw ie
-        case e: Exception => {
-          error("Failed to process feature ZK node change event. The broker will eventually exit.", e)
+        case cacheUpdateException: FeatureCacheUpdateException =>
+          error("Failed to process feature ZK node change event. The broker will eventually exit.", cacheUpdateException)
           throw new FatalExitError(1)
-        }
+        case e: Exception =>
+          // do not exit for exceptions unrelated to cache change processing (e.g. ZK session expiration)
+          warn("Unexpected exception in feature ZK node change event processing; will continue processing.", e)
       }
     }
   }