Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-15755

LeaveGroupResponse v0-v2 should handle no members

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.4.2, 3.5.2, 3.7.0, 3.6.1
    • None
    • None

    Description

      When Sarama and Librdkafka consumer clients issue LeaveGroup requests, they use an older protocol version < 3 which did not include a `members` field.

      Since our upgrade the kafka broker 3.4.1 we have started seeing these broker exceptions:

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

       
      KIP-848 introduced a check in LeaveGroupResponse that the members field must have 1 element. In some error cases, it seems like the members field has 0 elements - which would still be a valid response for v0-v2 messages, but this exception was being thrown.

      Instead of throwing an exception in this case, continue with the LeaveGroupResponse, since it is not a field included in v0 - v2 responses anyway.

      Attachments

        Issue Links

          Activity

            People

              wolfchimneyrock Robert Wagner
              wolfchimneyrock Robert Wagner
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: