You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Cong Ding (Jira)" <ji...@apache.org> on 2021/07/29 03:38:00 UTC

[jira] [Created] (KAFKA-13149) Null Pointer Exception when record==null at produce path

Cong Ding created KAFKA-13149:
---------------------------------

             Summary: Null Pointer Exception when record==null at produce path
                 Key: KAFKA-13149
                 URL: https://issues.apache.org/jira/browse/KAFKA-13149
             Project: Kafka
          Issue Type: Bug
          Components: log
            Reporter: Cong Ding


In production, we have seen an exception
{code:java}
java.lang.NullPointerException: Cannot invoke "org.apache.kafka.common.record.Record.hasMagic(byte)" because "record" is null{code}
which is triggered by
 [https://github.com/apache/kafka/blob/bfc57aa4ddcd719fc4a646c2ac09d4979c076455/core/src/main/scala/kafka/log/LogValidator.scala#L191]
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.

We should let the broker throw an invalid record exception and notify clients



--
This message was sent by Atlassian Jira
(v8.3.4#803005)