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)