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

Null Pointer Exception for record==null when handling a produce request

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.1
    • log
    • None

    Description

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

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ccding Cong Ding
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: