diff --git a/core/src/main/scala/kafka/server/FinalizedFeatureChangeListener.scala b/core/src/main/scala/kafka/server/FinalizedFeatureChangeListener.scala index 57413ae931ba..8bcce872c610 100644 --- a/core/src/main/scala/kafka/server/FinalizedFeatureChangeListener.scala +++ b/core/src/main/scala/kafka/server/FinalizedFeatureChangeListener.scala @@ -17,7 +17,7 @@ package kafka.server -import kafka.server.metadata.ZkMetadataCache +import kafka.server.metadata.{FeatureCacheUpdateException, ZkMetadataCache} import java.util.concurrent.{CountDownLatch, LinkedBlockingQueue, TimeUnit} import kafka.utils.Logging @@ -160,10 +160,12 @@ class FinalizedFeatureChangeListener(private val finalizedFeatureCache: ZkMetada // 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) } } }