In production, we have seen an exception
java.lang.NullPointerException: Cannot invoke "org.apache.kafka.common.record.Record.hasMagic(byte)" because "record" is null
which is triggered by
when handling a produce request.
The reason is that https://github.com/apache/kafka/blob/bfc57aa4ddcd719fc4a646c2ac09d4979c076455/clients/src/main/java/org/apache/kafka/common/record/DefaultRecord.java#L294-L296 returns record==null, which is possibly caused by a bad client. However, we have no idea about the client in our multi-tenant environment.
We should let the broker throw an invalid record exception and notify clients.
- links to