You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "wolfchimneyrock (via GitHub)" <gi...@apache.org> on 2023/10/25 14:16:01 UTC
[PR] MINOR: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
wolfchimneyrock opened a new pull request, #14635:
URL: https://github.com/apache/kafka/pull/14635
KIP-848 introduced this check, but we have seen since upgrading to broker 3.4 with both Sarama and Librdkafka clients when issuing LeaveGroup and getting an error, the single member gets lost somewhere in the broker between the request and the response.
instead of raising an exception when there are 0 members in the response, let it pass like it did before KIP-848.
*More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.*
*Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.*
### 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.
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: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "wolfchimneyrock (via GitHub)" <gi...@apache.org>.
wolfchimneyrock commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1779439685
I'm not sure I can elaborate on what the underlying error response that would have been sent with the LeaveGroup is, since the current code raises that exception without printing the topLevelError
--
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] KAFKA-15755: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1812962335
@wolfchimneyrock I just did it. Let's see how the next build goes.
--
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: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1783402130
@wolfchimneyrock Thanks again for the PR. We verified and your suggestion makes sense. I have two asks:
1) Could you please file a bug and use the the jira id in the PR?
2) Would it be possible to add a small unit test for the fix?
--
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] KAFKA-15755: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1812239280
I cannot get a clean build for this one. @wolfchimneyrock Could you please merge trunk to your branch?
--
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] KAFKA-15755: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "wolfchimneyrock (via GitHub)" <gi...@apache.org>.
wolfchimneyrock commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1804254506
> @wolfchimneyrock Would you have time to address my comments in the coming days?
yes, though I thought you were waiting on comment from @dongnuo123
--
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] KAFKA-15755: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dongnuo123 (via GitHub)" <gi...@apache.org>.
dongnuo123 commented on code in PR #14635:
URL: https://github.com/apache/kafka/pull/14635#discussion_r1392673477
##########
clients/src/main/java/org/apache/kafka/common/requests/LeaveGroupResponse.java:
##########
@@ -62,7 +62,7 @@ public LeaveGroupResponse(LeaveGroupResponseData data, short version) {
if (version >= 3) {
this.data = data;
} else {
- if (data.members().size() != 1) {
Review Comment:
Yeah it makes more sense
--
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] KAFKA-15755: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac merged PR #14635:
URL: https://github.com/apache/kafka/pull/14635
--
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] KAFKA-15755: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1803911181
@wolfchimneyrock Would you have time to address my comments in the coming days?
--
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: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "wolfchimneyrock (via GitHub)" <gi...@apache.org>.
wolfchimneyrock commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1779425711
> @wolfchimneyrock Thanks for the PR. I am not to fully understand the issue yet. Could you please elaborate a bit more about the condition leading to it?
there is more context here:
https://github.com/confluentinc/librdkafka/issues/4402
--
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: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1779417281
@wolfchimneyrock Thanks for the PR. I am not to fully understand the issue yet. Could you please elaborate a bit more about the condition leading to it?
--
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] KAFKA-15755: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dongnuo123 (via GitHub)" <gi...@apache.org>.
dongnuo123 commented on code in PR #14635:
URL: https://github.com/apache/kafka/pull/14635#discussion_r1392761140
##########
clients/src/main/java/org/apache/kafka/common/requests/LeaveGroupResponse.java:
##########
@@ -62,7 +62,7 @@ public LeaveGroupResponse(LeaveGroupResponseData data, short version) {
if (version >= 3) {
this.data = data;
} else {
- if (data.members().size() != 1) {
Review Comment:
Do we need to use
```
if (data.errorCode() != Errors.NONE.code() && data.members().size() == 0) {
this.data = new LeaveGroupResponseData().setErrorCode(data.errorCode());
} else {...
```
I can't think of a situation where the top level error code is set and the response has multiple members but just to make sure.
--
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] KAFKA-15755: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1804333051
@wolfchimneyrock Understood. If you agree with my suggestion, I think that we could just do it. Sorry for the confusion.
--
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] KAFKA-15755: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "wolfchimneyrock (via GitHub)" <gi...@apache.org>.
wolfchimneyrock commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1804548652
looks like all the jenkins agents ran out of disk space. After your comments, the tests still pass locally for me.
--
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] KAFKA-15755: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #14635:
URL: https://github.com/apache/kafka/pull/14635#discussion_r1388489571
##########
clients/src/test/java/org/apache/kafka/common/requests/LeaveGroupResponseTest.java:
##########
@@ -165,4 +169,55 @@ public void testEqualityWithMemberResponses() {
assertEquals(primaryResponse.hashCode(), reversedResponse.hashCode());
}
}
+
+ @ParameterizedTest
+ @ApiKeyVersionsSource(apiKey = ApiKeys.LEAVE_GROUP)
+ public void testNoErrorNoMembersResponses(short version) {
+ LeaveGroupResponseData data = new LeaveGroupResponseData()
+ .setErrorCode(Errors.NONE.code())
+ .setMembers(Collections.emptyList());
+
+ if (version < 3) {
+ assertThrows(UnsupportedVersionException.class,
+ () -> new LeaveGroupResponse(data, version));
+ } else {
+ LeaveGroupResponse response = new LeaveGroupResponse(data, version);
+ assertEquals(Errors.NONE, response.topLevelError());
Review Comment:
nit: Should we also assert the members here?
##########
clients/src/test/java/org/apache/kafka/common/requests/LeaveGroupResponseTest.java:
##########
@@ -165,4 +169,55 @@ public void testEqualityWithMemberResponses() {
assertEquals(primaryResponse.hashCode(), reversedResponse.hashCode());
}
}
+
+ @ParameterizedTest
+ @ApiKeyVersionsSource(apiKey = ApiKeys.LEAVE_GROUP)
+ public void testNoErrorNoMembersResponses(short version) {
+ LeaveGroupResponseData data = new LeaveGroupResponseData()
+ .setErrorCode(Errors.NONE.code())
+ .setMembers(Collections.emptyList());
+
+ if (version < 3) {
+ assertThrows(UnsupportedVersionException.class,
+ () -> new LeaveGroupResponse(data, version));
+ } else {
+ LeaveGroupResponse response = new LeaveGroupResponse(data, version);
+ assertEquals(Errors.NONE, response.topLevelError());
+ }
+ }
+
+ @ParameterizedTest
+ @ApiKeyVersionsSource(apiKey = ApiKeys.LEAVE_GROUP)
+ public void testNoErrorMultipleMembersResponses(short version) {
+ LeaveGroupResponseData data = new LeaveGroupResponseData()
+ .setErrorCode(Errors.NONE.code())
+ .setMembers(memberResponses);
+
+ if (version < 3) {
+ assertThrows(UnsupportedVersionException.class,
+ () -> new LeaveGroupResponse(data, version));
Review Comment:
nit: Could we also intend this one with 4 spaces?
##########
clients/src/test/java/org/apache/kafka/common/requests/LeaveGroupResponseTest.java:
##########
@@ -165,4 +169,55 @@ public void testEqualityWithMemberResponses() {
assertEquals(primaryResponse.hashCode(), reversedResponse.hashCode());
}
}
+
+ @ParameterizedTest
+ @ApiKeyVersionsSource(apiKey = ApiKeys.LEAVE_GROUP)
+ public void testNoErrorNoMembersResponses(short version) {
+ LeaveGroupResponseData data = new LeaveGroupResponseData()
+ .setErrorCode(Errors.NONE.code())
+ .setMembers(Collections.emptyList());
+
+ if (version < 3) {
+ assertThrows(UnsupportedVersionException.class,
+ () -> new LeaveGroupResponse(data, version));
Review Comment:
nit: Could we indent this line with 4 spaces in order to remain consistent with the existing code?
##########
clients/src/test/java/org/apache/kafka/common/requests/LeaveGroupResponseTest.java:
##########
@@ -165,4 +169,55 @@ public void testEqualityWithMemberResponses() {
assertEquals(primaryResponse.hashCode(), reversedResponse.hashCode());
}
}
+
+ @ParameterizedTest
+ @ApiKeyVersionsSource(apiKey = ApiKeys.LEAVE_GROUP)
+ public void testNoErrorNoMembersResponses(short version) {
+ LeaveGroupResponseData data = new LeaveGroupResponseData()
+ .setErrorCode(Errors.NONE.code())
+ .setMembers(Collections.emptyList());
+
+ if (version < 3) {
+ assertThrows(UnsupportedVersionException.class,
+ () -> new LeaveGroupResponse(data, version));
+ } else {
+ LeaveGroupResponse response = new LeaveGroupResponse(data, version);
+ assertEquals(Errors.NONE, response.topLevelError());
+ }
+ }
+
+ @ParameterizedTest
+ @ApiKeyVersionsSource(apiKey = ApiKeys.LEAVE_GROUP)
+ public void testNoErrorMultipleMembersResponses(short version) {
+ LeaveGroupResponseData data = new LeaveGroupResponseData()
+ .setErrorCode(Errors.NONE.code())
+ .setMembers(memberResponses);
+
+ if (version < 3) {
+ assertThrows(UnsupportedVersionException.class,
+ () -> new LeaveGroupResponse(data, version));
+ } else {
+ LeaveGroupResponse response = new LeaveGroupResponse(data, version);
+ assertEquals(Errors.NONE, response.topLevelError());
Review Comment:
nit: Should we also assert members 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] KAFKA-15755: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1814097094
Merged to trunk, 3.6, 3.5 and 3.4.
--
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] KAFKA-15755: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #14635:
URL: https://github.com/apache/kafka/pull/14635#discussion_r1383049498
##########
clients/src/main/java/org/apache/kafka/common/requests/LeaveGroupResponse.java:
##########
@@ -62,7 +62,7 @@ public LeaveGroupResponse(LeaveGroupResponseData data, short version) {
if (version >= 3) {
this.data = data;
} else {
- if (data.members().size() != 1) {
Review Comment:
I was looking a bit more into this issue. I think that we could harden a bit the logic because we could effectively get no members only when there is a top level error. How about this?
```
if (data.errorCode() != Errors.NONE.code()) {
this.data = new LeaveGroupResponseData().setErrorCode(data.errorCode());
} else {
if (data.members().size() != 1) {
throw new UnsupportedVersionException("LeaveGroup response version " + version +
" can only contain one member, got " + data.members().size() + " members.");
}
this.data = new LeaveGroupResponseData().setErrorCode(data.members().get(0).errorCode());
}
```
@dongnuo123 What do you think?
##########
clients/src/test/java/org/apache/kafka/common/requests/LeaveGroupResponseTest.java:
##########
@@ -165,4 +167,33 @@ public void testEqualityWithMemberResponses() {
assertEquals(primaryResponse.hashCode(), reversedResponse.hashCode());
}
}
+
+ @Test
Review Comment:
nit: You could use the following to parameterized the test.
```
@ParameterizedTest
@ApiKeyVersionsSource(apiKey = ApiKeys.LEAVE_GROUP)
```
--
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] KAFKA-15755: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dongnuo123 (via GitHub)" <gi...@apache.org>.
dongnuo123 commented on code in PR #14635:
URL: https://github.com/apache/kafka/pull/14635#discussion_r1392673477
##########
clients/src/main/java/org/apache/kafka/common/requests/LeaveGroupResponse.java:
##########
@@ -62,7 +62,7 @@ public LeaveGroupResponse(LeaveGroupResponseData data, short version) {
if (version >= 3) {
this.data = data;
} else {
- if (data.members().size() != 1) {
Review Comment:
Yeah it makes more sense
--
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: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1781346471
Thanks @wolfchimneyrock. We will take a look into it.
--
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: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "wolfchimneyrock (via GitHub)" <gi...@apache.org>.
wolfchimneyrock commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1779515287
Here is a broker trace:
```
[2023-10-24 01:17:17,214] ERROR [KafkaApi-28598] Unexpected error handling request RequestHeader(apiKey=LEAVE_GROUP, apiVersion=1, clientId=REDACTED, correlationId=116775, headerVersion=1) -- LeaveGroupRequestData(groupId='REDACTED, memberId='REDACTED-73967453-93c4-4f3f-bcef-32c1f280350f', members=[]) with context RequestContext(header=RequestHeader(apiKey=LEAVE_GROUP, apiVersion=1, clientId=REDACTED, correlationId=116775, headerVersion=1), connectionId='REDACTED', clientAddress=/REDACTED, principal=REDACTED, listenerName=ListenerName(PLAINTEXT), securityProtocol=PLAINTEXT, clientInformation=ClientInformation(softwareName=confluent-kafka-python, softwareVersion=1.7.0-rdkafka-1.7.0), fromPrivilegedListener=false, principalSerde=Optional[REDACTED]) (kafka.server.KafkaApis)
java.util.concurrent.CompletionException: org.apache.kafka.common.errors.UnsupportedVersionException: LeaveGroup response version 1 can only contain one member, got 0 members.
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
at java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:936)
at java.base/java.util.concurrent.CompletableFuture.uniHandleStage(CompletableFuture.java:950)
at java.base/java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:2340)
at kafka.server.KafkaApis.handleLeaveGroupRequest(KafkaApis.scala:1796)
at kafka.server.KafkaApis.handle(KafkaApis.scala:196)
at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:75)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.apache.kafka.common.errors.UnsupportedVersionException: LeaveGroup response version 1 can only contain one member, got 0 members.
```
I see that the request has `memberId` set and `members=[]` as expected with an apiVersion=1 message ... maybe the LeaveGroupResponse just sees members=[] and isn't correctly populating the members list with the given memberId from the LeaveGroupRequest
--
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: LeaveGroupResponse v0 - v2 loses its member under certain error conditions [kafka]
Posted by "wolfchimneyrock (via GitHub)" <gi...@apache.org>.
wolfchimneyrock commented on PR #14635:
URL: https://github.com/apache/kafka/pull/14635#issuecomment-1783465122
> @wolfchimneyrock Thanks again for the PR. We verified and your suggestion makes sense. I have two asks:
>
> 1. Could you please file a bug and use the the jira id in the PR?
> 2. Would it be possible to add a small unit test for the fix?
sure, I've applied for an apache JIRA account, and I'll start on a unit test.
--
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