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

NPE from the provided metadata in client callback in case of ApiException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.6.0
    • 3.2.0
    • clients
    • None
    • Prod
    • Patch, Important

    Description

      1.
      org.apache.kafka.clients.producer.Callback interface has method onCompletion(...)
      Which says as part of the documentation :

      The metadata for the record that was sent (i.e. the partition and offset). *An empty metadata with -1 value for all fields except for topicPartition will be returned if an error occurred.

      We got an NPE from doSend(...) method in org.apache.kafka.clients.producer.KafkaProducer 
      Which can occur in case ApiException was thrown ...
      In case of ApiException it uses the regular callback instead of InterceptorCallback which also may cover the NPE.

      2. More over RecordMetadata has method partition() which return int but can also throw NPE because TopicPartition might be null.

      Stack trace attached.

       

      Attachments

        1. NPE.production
          2 kB
          Avi Youkhananov

        Issue Links

          Activity

            People

              pnee Philip Nee
              ayouk Avi Youkhananov
              Luke Chen Luke Chen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: