You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "YunKui Lu (Jira)" <ji...@apache.org> on 2022/04/01 02:30:00 UTC

[jira] [Created] (KAFKA-13791) Fix FetchResponse#`fetchData` and `forgottenTopics`: Assignment of lazy-initialized members should be the last step with double-checked locking

YunKui Lu created KAFKA-13791:
---------------------------------

             Summary: Fix FetchResponse#`fetchData` and `forgottenTopics`: Assignment of lazy-initialized members should be the last step with double-checked locking
                 Key: KAFKA-13791
                 URL: https://issues.apache.org/jira/browse/KAFKA-13791
             Project: Kafka
          Issue Type: Bug
          Components: clients
    Affects Versions: 3.0.1
            Reporter: YunKui Lu


Double-checked locking can be used for lazy initialization of volatile fields, but only if field assignment is the last step in the synchronized block. Otherwise, you run the risk of threads accessing a half-initialized object.

The problem is consistent with [KAFKA-13777|https://issues.apache.org/jira/projects/KAFKA/issues/KAFKA-13777]



--
This message was sent by Atlassian Jira
(v8.20.1#820001)