Skip to content

Sync 2 recent commits to 4.3#22656

Closed
dongnuo123 wants to merge 2 commits into
apache:4.3from
confluentinc:KAFKA-20662-4-3
Closed

Sync 2 recent commits to 4.3#22656
dongnuo123 wants to merge 2 commits into
apache:4.3from
confluentinc:KAFKA-20662-4-3

Conversation

@dongnuo123

Copy link
Copy Markdown
Contributor

…on in group coordinator (apache#22264)

The `deserialize*` methods in `ConsumerProtocol` only catch
`BufferUnderflowException` and re-wrap it as `SchemaException`.
Malformed bytes can also surface as other `RuntimeException`s (e.g.
`IllegalArgumentException` from negative array lengths in
`ByteBufferAccessor`), which escape these methods. Callers that only
guard against `SchemaException` then propagate the failure, which can
destabilize the group coordinator.

  ### Changes

  In `ConsumerProtocol`, broaden the `catch` clause from
`BufferUnderflowException` to `RuntimeException` in all four
deserialization entry points, re-wrapping as `SchemaException`:

  - `deserializeSubscription`
  - `deserializeConsumerProtocolSubscription`
  - `deserializeAssignment`
  - `deserializeConsumerProtocolAssignment`

Reviewers: Sean Quah <squah@confluent.io>, David Jacot
 <david.jacot@gmail.com>
…t during online migration (apache#22580)

When the subscription deserialization fails, we throw an
IllegalStateException
```
private static ConsumerProtocolSubscription deserializeSubscription(
  JoinGroupRequestProtocolCollection protocols
) {
  try {
  return ConsumerProtocol.deserializeConsumerProtocolSubscription(
    ByteBuffer.wrap(protocols.iterator().next().metadata()));
  }
  catch (SchemaException e) {
  throw new IllegalStateException("Malformed embedded consumer protocol
in subscription deserialization.");
  }
}
```
which will be translated to UNKNOWN_SERVER_ERROR. This is a bit
confusing to the client. We throw a fatal `INCONSISTENT_GROUP_PROTOCOL`
here instead.

Reviewers: David Jacot <david.jacot@gmail.com>
@dajac dajac closed this Jun 24, 2026
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.

2 participants