Skip to content

KAFKA-9251; Describing a non consumer group with the Admin API hangs forever#7763

Merged
hachikuji merged 2 commits into
apache:trunkfrom
dajac:KAFKA-9251
Dec 4, 2019
Merged

KAFKA-9251; Describing a non consumer group with the Admin API hangs forever#7763
hachikuji merged 2 commits into
apache:trunkfrom
dajac:KAFKA-9251

Conversation

@dajac

@dajac dajac commented Nov 29, 2019

Copy link
Copy Markdown
Member

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

context.future().complete(consumerGroupDescription);
} else {
context.future().completeExceptionally(new IllegalArgumentException(
"GroupId " + context.groupId() + " is not a consumer group."));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For completeness, could we add the protocolType to this message?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Thank for the suggestion.

authorizedOperations);
context.future().complete(consumerGroupDescription);
} else {
context.future().completeExceptionally(new IllegalArgumentException(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are your thoughts on having InvalidGroupIdException here?
In all regards the KafkaFuture will wrap it in an ExecutionException - I'm just wondering if user code could be checking whether the cause is a KafkaException.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this and I felt like InvalidGroupIdException was inappropriate because the group is is valid but the type of the group is not accepted. Thus, IllegalArgumentException sounds better to me in this case. Does it make sense?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's not straightforward. Let's see what others think

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with IllegalArgumentException. I think InvalidGroupIdException is typically used to indicate a groupId which is structurally invalid in some way (e.g. null).


@Test
public void testDescribeNonConsumerGroups() throws Exception {
final HashMap<Integer, Node> nodes = new HashMap<>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of duplication in these tests. No need to do it in this PR but I'm wondering if wrapping all the

 final HashMap<Integer, Node> nodes = new HashMap<>();
        nodes.put(0, new Node(0, "localhost", 8121));

        final Cluster cluster =
            new Cluster(
                "mockClusterId",
                nodes.values(),
                Collections.<PartitionInfo>emptyList(),
                Collections.<String>emptySet(),
                Collections.<String>emptySet(), nodes.get(0));

        try (AdminClientUnitTestEnv env = new AdminClientUnitTestEnv(cluster)) {

boilerplate into a single method that accepts a callable would look better in this test class

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally. If you don't mind, I will tackle this in a separate PR. I'd like to keep this one focus on the bugfix.

@stanislavkozlovski

Copy link
Copy Markdown
Contributor

Nice catch!

@dajac

dajac commented Dec 2, 2019

Copy link
Copy Markdown
Member Author

retest this please

@hachikuji hachikuji left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice find!

@hachikuji

Copy link
Copy Markdown
Contributor

retest this please

3 similar comments
@hachikuji

Copy link
Copy Markdown
Contributor

retest this please

@hachikuji

Copy link
Copy Markdown
Contributor

retest this please

@hachikuji

Copy link
Copy Markdown
Contributor

retest this please

@hachikuji hachikuji merged commit b0d89cb into apache:trunk Dec 4, 2019
hachikuji pushed a commit that referenced this pull request Dec 4, 2019
…forever (#7763)

If a non-consumer group is specified in `describeConsumerGroup`, the future will hang indefinitely because the future callback is never completed. This patch fixes the problem by completing the future exceptionally with an `IllegalArgumentException`.

Reviewers: Stanislav Kozlovski <stanislav_kozlovski@outlook.com>, Jason Gustafson <jason@confluent.io>
hachikuji pushed a commit that referenced this pull request Dec 4, 2019
…forever (#7763)

If a non-consumer group is specified in `describeConsumerGroup`, the future will hang indefinitely because the future callback is never completed. This patch fixes the problem by completing the future exceptionally with an `IllegalArgumentException`.

Reviewers: Stanislav Kozlovski <stanislav_kozlovski@outlook.com>, Jason Gustafson <jason@confluent.io>
@dajac dajac deleted the KAFKA-9251 branch October 6, 2020 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants