You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "dajac (via GitHub)" <gi...@apache.org> on 2025/11/28 08:24:19 UTC

[PR] MINOR: Ensure proper visibility of attribute accesses across threads [kafka]

dajac opened a new pull request, #21014:
URL: https://github.com/apache/kafka/pull/21014

   I found those two cases while working in this area. In both cases, they are read by multiple threads so they must either be volatile or acquiring the appropriate lock. Using volatile is fine here.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Ensure proper visibility of attribute accesses across threads [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #21014:
URL: https://github.com/apache/kafka/pull/21014#discussion_r2572056461


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java:
##########
@@ -345,7 +345,7 @@ public GroupCoordinatorService build() {
      * The metadata image to extract topic id to names map.
      * This is initialised when the {@link GroupCoordinator#onNewMetadataImage(CoordinatorMetadataImage, CoordinatorMetadataDelta)} is called
      */
-    private CoordinatorMetadataImage metadataImage = null;
+    private volatile CoordinatorMetadataImage metadataImage = null;

Review Comment:
   I assume those changes are bug fixes, and the 4.1 branch may have a next release.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Ensure proper visibility of attribute accesses across threads [kafka]

Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on PR #21014:
URL: https://github.com/apache/kafka/pull/21014#issuecomment-3592357157

   Sorry guys. I wanted to follow-up on this on Monday (due to the weekend). You got there before I could. Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Ensure proper visibility of attribute accesses across threads [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #21014:
URL: https://github.com/apache/kafka/pull/21014#discussion_r2572940839


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java:
##########
@@ -345,7 +345,7 @@ public GroupCoordinatorService build() {
      * The metadata image to extract topic id to names map.
      * This is initialised when the {@link GroupCoordinator#onNewMetadataImage(CoordinatorMetadataImage, CoordinatorMetadataDelta)} is called
      */
-    private CoordinatorMetadataImage metadataImage = null;
+    private volatile CoordinatorMetadataImage metadataImage = null;

Review Comment:
   It seems trunk is missing this fix. @majialong could you file a minor patch for trunk? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Ensure proper visibility of attribute accesses across threads [kafka]

Posted by "majialoong (via GitHub)" <gi...@apache.org>.
majialoong commented on code in PR #21014:
URL: https://github.com/apache/kafka/pull/21014#discussion_r2572948022


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java:
##########
@@ -345,7 +345,7 @@ public GroupCoordinatorService build() {
      * The metadata image to extract topic id to names map.
      * This is initialised when the {@link GroupCoordinator#onNewMetadataImage(CoordinatorMetadataImage, CoordinatorMetadataDelta)} is called
      */
-    private CoordinatorMetadataImage metadataImage = null;
+    private volatile CoordinatorMetadataImage metadataImage = null;

Review Comment:
   Open https://github.com/apache/kafka/pull/21021 for this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Ensure proper visibility of attribute accesses across threads [kafka]

Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac merged PR #21014:
URL: https://github.com/apache/kafka/pull/21014


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Ensure proper visibility of attribute accesses across threads [kafka]

Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #21014:
URL: https://github.com/apache/kafka/pull/21014#discussion_r2573514542


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java:
##########
@@ -345,7 +345,7 @@ public GroupCoordinatorService build() {
      * The metadata image to extract topic id to names map.
      * This is initialised when the {@link GroupCoordinator#onNewMetadataImage(CoordinatorMetadataImage, CoordinatorMetadataDelta)} is called
      */
-    private CoordinatorMetadataImage metadataImage = null;
+    private volatile CoordinatorMetadataImage metadataImage = null;

Review Comment:
   Trunk is covered by https://github.com/apache/kafka/pull/21008.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Ensure proper visibility of attribute accesses across threads [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #21014:
URL: https://github.com/apache/kafka/pull/21014#issuecomment-3591528610

   open #21020 for the backport


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org