kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject kafka git commit: KAFKA-4409; Fix deadlock between topic event handling and shutdown in ZookeeperConsumerConnector
Date Mon, 14 Nov 2016 17:59:20 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk b7d36b726 -> 1f1d45006


KAFKA-4409; Fix deadlock between topic event handling and shutdown in ZookeeperConsumerConnector

The consumer can deadlock on shutdown if a topic event fires during shutdown. The shutdown
acquires the rebalance lock and then the topic-event-watcher lock. The topic event watcher
acquires these in the reverse order. Shutdown should not need to acquire the topic-event-watcher’s
lock - all it does is unsubscribes from topic events.

Author: Joel Koshy <jjkoshy@gmail.com>

Reviewers: Jiangjie Qin <becket.qin@gmail.com>

Closes #2129 from jjkoshy/KAFKA-4409


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/1f1d4500
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/1f1d4500
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/1f1d4500

Branch: refs/heads/trunk
Commit: 1f1d4500623275ca05fe661b608a5119bde934ed
Parents: b7d36b7
Author: Joel Koshy <jjkoshy@gmail.com>
Authored: Mon Nov 14 09:58:53 2016 -0800
Committer: Jiangjie Qin <becket.qin@gmail.com>
Committed: Mon Nov 14 09:58:53 2016 -0800

----------------------------------------------------------------------
 .../main/scala/kafka/consumer/ZookeeperConsumerConnector.scala   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/1f1d4500/core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala b/core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala
index 81b6264..fbe7089 100755
--- a/core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala
+++ b/core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala
@@ -211,9 +211,9 @@ private[kafka] class ZookeeperConsumerConnector(val config: ConsumerConfig,
       info("ZKConsumerConnector shutting down")
       val startTime = System.nanoTime()
       KafkaMetricsGroup.removeAllConsumerMetrics(config.clientId)
+      if (wildcardTopicWatcher != null)
+        wildcardTopicWatcher.shutdown()
       rebalanceLock synchronized {
-        if (wildcardTopicWatcher != null)
-          wildcardTopicWatcher.shutdown()
         try {
           if (config.autoCommitEnable)
 	        scheduler.shutdown()


Mime
View raw message