Jean-Baptiste Mazon created KAFKA-13307: -------------------------------------------
Summary: NPE in SyncGroup after an “empty” JoinGroup Key: KAFKA-13307 URL: https://issues.apache.org/jira/browse/KAFKA-13307 Project: Kafka Issue Type: Bug Affects Versions: 2.8.0 Environment: This is kafka_2.13-2.8.0, tarball from the website, on a single-host 3-node Linux 5.13.13 setup. Reporter: Jean-Baptiste Mazon Attachments: join_then_sync.raw Got this while socket-hacking on my raw consumer (binary messages attached, but may not be that directly usable as there's a generated UUID involved). Summary: # → JoinGroup Request v0 (groupId = "test-consumer", sessionTimeoutMs = 10000, memberId = empty string, protocolType = "consumer", protocols = empty array) # ← JoinGroup Response v0 (errorCode = 0 (None), generationId = 7, protocolName = empty string, leader = "null-cd85a8fc-b376-44aa-a4b0-641d01466d10", memberId = "null-cd85a8fc-b376-44aa-a4b0-641d01466d10", members = [\{memberId = "null-cd85a8fc-b376-44aa-a4b0-641d01466d10", metadata = empty bytes}]) # → SyncGroup Request v0 (groupId = "test-consumer", generationId = echo, memberId = echo, assignments = empty bytes) # ← SyncGroup Response v0 (errorCode = -1 (*UnknownServerError, with a NPE*), memberAssignment = empty bytes) Server-side log: {noformat} [2021-09-16 21:46:15,979] ERROR [KafkaApi-0] Error when handling request: clientId=null, correlationId=67305986, api=SYNC_GROUP, version=0, body=SyncGroupRequestData(groupId='test-consumer', generationId=6, memberId='null-0e29c037-55b7-413a-9822-8b9d87b49a89', groupInstanceId=null, protocolType=null, protocolName=null, assignments=[]) (kafka.server.RequestHandlerHelper) java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "this.clientId" is null at kafka.internals.generated.GroupMetadataValue$MemberMetadata.addSize(GroupMetadataValue.java:643) at kafka.internals.generated.GroupMetadataValue.addSize(GroupMetadataValue.java:261) at org.apache.kafka.common.protocol.Message.size(Message.java:51) at org.apache.kafka.common.protocol.MessageUtil.toVersionPrefixedByteBuffer(MessageUtil.java:201) at org.apache.kafka.common.protocol.MessageUtil.toVersionPrefixedBytes(MessageUtil.java:210) at kafka.coordinator.group.GroupMetadataManager$.groupMetadataValue(GroupMetadataManager.scala:1065) at kafka.coordinator.group.GroupMetadataManager.storeGroup(GroupMetadataManager.scala:250) at kafka.coordinator.group.GroupCoordinator.$anonfun$doSyncGroup$1(GroupCoordinator.scala:421) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) at kafka.coordinator.group.GroupMetadata.inLock(GroupMetadata.scala:227) at kafka.coordinator.group.GroupCoordinator.handleSyncGroup(GroupCoordinator.scala:381) at kafka.server.KafkaApis.handleSyncGroupRequest(KafkaApis.scala:1555) at kafka.server.KafkaApis.handle(KafkaApis.scala:181) at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:74) at java.base/java.lang.Thread.run(Thread.java:831){noformat} A similar one can be triggered with DescribeGroups by launching {{kafka-consumer-groups.sh --describe --group test-consumer}} shortly after: {noformat} [2021-09-16 21:47:49,911] ERROR [KafkaApi-0] Error when handling request: clientId=adminclient-1, correlationId=4, api=DESCRIBE_GROUPS, version=5, body=DescribeGroupsRequestData(groups=[test-consumer], includeAuthorizedOperations=false) (kafka.server.RequestHandlerHelper) java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "this.clientId" is null at org.apache.kafka.common.message.DescribeGroupsResponseData$DescribedGroupMember.addSize(DescribeGroupsResponseData.java:1116) at org.apache.kafka.common.message.DescribeGroupsResponseData$DescribedGroup.addSize(DescribeGroupsResponseData.java:640) at org.apache.kafka.common.message.DescribeGroupsResponseData.addSize(DescribeGroupsResponseData.java:212) at org.apache.kafka.common.protocol.SendBuilder.buildSend(SendBuilder.java:218) at org.apache.kafka.common.protocol.SendBuilder.buildResponseSend(SendBuilder.java:200) at org.apache.kafka.common.requests.AbstractResponse.toSend(AbstractResponse.java:43) at org.apache.kafka.common.requests.RequestContext.buildResponseSend(RequestContext.java:111) at kafka.network.RequestChannel$Request.buildResponseSend(RequestChannel.scala:132) at kafka.server.RequestHandlerHelper.sendResponse(RequestHandlerHelper.scala:185) at kafka.server.RequestHandlerHelper.sendResponseMaybeThrottle(RequestHandlerHelper.scala:101) at kafka.server.KafkaApis.sendResponseCallback$3(KafkaApis.scala:1378) at kafka.server.KafkaApis.handleDescribeGroupRequest(KafkaApis.scala:1417) at kafka.server.KafkaApis.handle(KafkaApis.scala:182) at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:74) at java.base/java.lang.Thread.run(Thread.java:831){noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)