You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/03/23 10:11:18 UTC

[GitHub] [kafka] LiamClarkeNZ commented on a change in pull request #11920: KAFKA-13672 Race condition in DynamicBrokerConfig

LiamClarkeNZ commented on a change in pull request #11920:
URL: https://github.com/apache/kafka/pull/11920#discussion_r833080985



##########
File path: core/src/main/scala/kafka/server/DynamicBrokerConfig.scala
##########
@@ -201,7 +202,9 @@ class DynamicBrokerConfig(private val kafkaConfig: KafkaConfig) extends Logging
   private[server] val staticDefaultConfigs = ConfigDef.convertToStringMapWithPasswordValues(KafkaConfig.defaultValues.asJava).asScala
   private val dynamicBrokerConfigs = mutable.Map[String, String]()
   private val dynamicDefaultConfigs = mutable.Map[String, String]()
-  private val reconfigurables = mutable.Buffer[Reconfigurable]()
+
+  // Use COWArrayList to prevent concurrent modification exception when reconfigurable added while iteration over list occurring
+  private val reconfigurables = new CopyOnWriteArrayList[Reconfigurable]()
   private val brokerReconfigurables = mutable.Buffer[BrokerReconfigurable]()

Review comment:
       That's a good question. I am happy to do so, I don't have much experience in this area of code, I just wanted to help eliminate some flaky tests. I can't see any downsides to doing so. 




-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org