You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Ismael Juma (JIRA)" <ji...@apache.org> on 2017/12/11 11:15:00 UTC

[jira] [Commented] (KAFKA-6341) 'networkThreadTimeNanos' in KafkaChannel is not thread safe

    [ https://issues.apache.org/jira/browse/KAFKA-6341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16285781#comment-16285781 ] 

Ismael Juma commented on KAFKA-6341:
------------------------------------

The intent is for the variable to be accessed from a single thread. Please elaborate why you think multiple threads are updating it. cc [~rsivaram]

> 'networkThreadTimeNanos' in KafkaChannel is not thread safe
> -----------------------------------------------------------
>
>                 Key: KAFKA-6341
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6341
>             Project: Kafka
>          Issue Type: Bug
>          Components: metrics
>    Affects Versions: 1.0.0
>            Reporter: huxihx
>
> `networkThreadTimeNanos` in KafkaChannel is of primitive long type which is not thread safe. Multiple Processor threads could access(read and write) this variable at the same time. Since JVM spec does not guarantee of the atomic 64-bit operations against long/double types, it's safer to employ AtomicLong instead of the naive long type.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)