[ https://issues.apache.org/jira/browse/KAFKA-9340?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Roman Leventov updated KAFKA-9340: ---------------------------------- Description: It's not clear why the {{used}} field in {{AbstractConfig}} should be a synchronized set, but if does need to be synchronized, there is a race condition in this line: [https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java#L214] {{keys.removeAll(used);}} Possible fixes: 1. Document (e. g. in a comment) why {{used}} should be synchronized, and replace line 214 with synchronized (used) \{ keys.removeAll(used); } 2. Remove unnecessary synchronization of {{used}} was: It's not clear why the {{used}} field in {{AbstractConfig}} should be a synchronized set, but if does need to be synchronized, there is a race condition in this line: [https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java#L214] {{keys.removeAll(used);}} Possible fixes: 1. Document (e. g. in a comment) why {{used}} should be synchronized, and replace line 214 with {{synchronized (used) \{ keys.removeAll(used); }}} 2. Remove unnecessary synchronization of {{used}} > Potential race condition in AbstractConfig > ------------------------------------------ > > Key: KAFKA-9340 > URL: https://issues.apache.org/jira/browse/KAFKA-9340 > Project: Kafka > Issue Type: Bug > Reporter: Roman Leventov > Priority: Minor > > It's not clear why the {{used}} field in {{AbstractConfig}} should be a > synchronized set, but if does need to be synchronized, there is a race > condition in this line: > [https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java#L214] > {{keys.removeAll(used);}} > > Possible fixes: > 1. Document (e. g. in a comment) why {{used}} should be synchronized, and > replace line 214 with synchronized (used) \{ keys.removeAll(used); } > 2. Remove unnecessary synchronization of {{used}} -- This message was sent by Atlassian Jira (v8.3.4#803005)