You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/09/29 05:06:00 UTC

[GitHub] [kafka] chia7712 opened a new pull request #9349: MINOR: add proper checks to KafkaConsumer.groupMetadata

chia7712 opened a new pull request #9349:
URL: https://github.com/apache/kafka/pull/9349


   add following checks to ```KafkaConsumer.groupMetadata```
   
   1. null check of coordinator (replace NPE by ```InvalidGroupIdException``` which is same to other methods)
   1. concurrent check (```groupMetadata``` is not thread-safe so concurrent check is necessary)
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


----------------------------------------------------------------
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.

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



[GitHub] [kafka] hachikuji merged pull request #9349: MINOR: add proper checks to KafkaConsumer.groupMetadata

Posted by GitBox <gi...@apache.org>.
hachikuji merged pull request #9349:
URL: https://github.com/apache/kafka/pull/9349


   


----------------------------------------------------------------
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.

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



[GitHub] [kafka] chia7712 commented on a change in pull request #9349: MINOR: add proper checks to KafkaConsumer.groupMetadata

Posted by GitBox <gi...@apache.org>.
chia7712 commented on a change in pull request #9349:
URL: https://github.com/apache/kafka/pull/9349#discussion_r498176515



##########
File path: clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java
##########
@@ -1994,6 +1995,24 @@ public void testGetGroupMetadata() {
         assertEquals(groupInstanceId, groupMetadataAfterPoll.groupInstanceId());
     }
 
+    @Test
+    public void testInvalidGroupMetadata() {
+        Properties props = new Properties();
+        props.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9999");
+        props.setProperty(ConsumerConfig.METRIC_REPORTER_CLASSES_CONFIG, MockMetricsReporter.class.getName());
+        KafkaConsumer<String, String> consumer = new KafkaConsumer<>(
+                props, new StringDeserializer(), new StringDeserializer());
+
+        // concurrent access is illegal
+        consumer.currentThread.set(123);

Review comment:
       will Roger that!




----------------------------------------------------------------
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.

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



[GitHub] [kafka] hachikuji commented on a change in pull request #9349: MINOR: add proper checks to KafkaConsumer.groupMetadata

Posted by GitBox <gi...@apache.org>.
hachikuji commented on a change in pull request #9349:
URL: https://github.com/apache/kafka/pull/9349#discussion_r497681395



##########
File path: clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java
##########
@@ -1994,6 +1995,24 @@ public void testGetGroupMetadata() {
         assertEquals(groupInstanceId, groupMetadataAfterPoll.groupInstanceId());
     }
 
+    @Test
+    public void testInvalidGroupMetadata() {
+        Properties props = new Properties();
+        props.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9999");
+        props.setProperty(ConsumerConfig.METRIC_REPORTER_CLASSES_CONFIG, MockMetricsReporter.class.getName());
+        KafkaConsumer<String, String> consumer = new KafkaConsumer<>(
+                props, new StringDeserializer(), new StringDeserializer());
+
+        // concurrent access is illegal
+        consumer.currentThread.set(123);

Review comment:
       Another way to test this might be to use `MockClient.enableBlockingUntilWakeup`. That would let us block in `Consumer.poll`.




----------------------------------------------------------------
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.

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