[ 
https://issues.apache.org/jira/browse/KAFKA-9950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Konstantine Karantasis resolved KAFKA-9950.
-------------------------------------------
    Resolution: Fixed

> MirrorMaker2 sharing of ConfigDef can lead to ConcurrentModificationException
> -----------------------------------------------------------------------------
>
>                 Key: KAFKA-9950
>                 URL: https://issues.apache.org/jira/browse/KAFKA-9950
>             Project: Kafka
>          Issue Type: Bug
>          Components: mirrormaker
>    Affects Versions: 2.4.0, 2.5.0, 2.4.1
>            Reporter: Chris Egerton
>            Assignee: Chris Egerton
>            Priority: Major
>             Fix For: 2.6.0, 2.4.2, 2.5.1
>
>
> The 
> [MirrorConnectorConfig::CONNECTOR_CONFIG_DEF|https://github.com/apache/kafka/blob/34824b7bff64ba387a04466d74ac6bbbd10bf37c/connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorConnectorConfig.java#L397]
>  object is reused across multiple MirrorMaker2 classes, which is fine the 
> most part since it's a constant. However, the actual {{ConfigDef}} object 
> itself is mutable, and is mutated when the {{MirrorTaskConfig}} class 
> [statically constructs its own 
> ConfigDef|https://github.com/apache/kafka/blob/34824b7bff64ba387a04466d74ac6bbbd10bf37c/connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorTaskConfig.java#L62].
> This has two unintended effects:
>  # Since the two {{ConfigDef}} objects for the {{MirrorConnectorConfig}} and 
> {{MirrorTaskConfig}} classes are actually the same object, the additional 
> properties that the {{MirrorTaskConfig}} class defines for its {{ConfigDef}} 
> are also added to the {{MirrorConnectorConfig}} class's {{ConfigDef}}. The 
> impact of this isn't huge since both additional properties have default 
> values, but this does cause those properties to appear in the 
> {{/connectors/\{name}/config/validate}} endpoint once the 
> {{MirrorTaskConfig}} class is loaded for the first time.
>  # It's possible that, if a config for a MirrorMaker2 connector is submitted 
> at approximately the same time that the {{MirrorTaskConfig}} class is loaded, 
> a {{ConcurrentModificationException}} will be thrown by the 
> {{AbstractHerder}} class when it tries to [iterate over all of the keys of 
> the connector's 
> ConfigDef|https://github.com/apache/kafka/blob/34824b7bff64ba387a04466d74ac6bbbd10bf37c/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/AbstractHerder.java#L357].



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to