[ https://issues.apache.org/jira/browse/KAFKA-9340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17007646#comment-17007646 ]
M. Manna commented on KAFKA-9340: --------------------------------- Perhaps someone else can confirm this too? I am not sure why synchronization is required here. Config provider usage is independent, or at least, it should be. If it's independent, shouldn't we simply remove all synchronization from here? Also, used/unused vars are more for checking what's been used, and log items. Perhaps the intention is to ensure that the correct information is logged ? in that case, would a concurrent variant e.g. ConcurrentSkipListSet be better? > 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)