You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "huxihx (JIRA)" <ji...@apache.org> on 2017/12/04 03:19:00 UTC
[jira] [Commented] (KAFKA-6303) Potential lack of synchronization
in NioEchoServer#AcceptorThread
[ https://issues.apache.org/jira/browse/KAFKA-6303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16276243#comment-16276243 ]
huxihx commented on KAFKA-6303:
-------------------------------
`newChannels` is already wrapped with Collections.synchronizedList, so it should be thread-safe for a non-compound action, but I do agree that it needs an explicit locking for a compound action(say putIfAbsent).
> Potential lack of synchronization in NioEchoServer#AcceptorThread
> -----------------------------------------------------------------
>
> Key: KAFKA-6303
> URL: https://issues.apache.org/jira/browse/KAFKA-6303
> Project: Kafka
> Issue Type: Bug
> Reporter: Ted Yu
> Priority: Minor
>
> In the run() method:
> {code}
> SocketChannel socketChannel = ((ServerSocketChannel) key.channel()).accept();
> socketChannel.configureBlocking(false);
> newChannels.add(socketChannel);
> {code}
> Modification to newChannels should be protected by synchronized block.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)