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

Wrong configuration of metric.reporters lead to NPE in KafkaProducer constructor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.7.0, 3.8.0, 3.7.1
    • 4.0.0
    • clients, producer
    • None

    Description

      if the metric.reporters property contains some invalid class, the KafkaProducer constructor fails with non explicit NPE:

      Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.util.Optional.ifPresent(java.util.function.Consumer)" because "this.clientTelemetryReporter" is null
          at org.apache.kafka.clients.producer.KafkaProducer.close(KafkaProducer.java:1424)
          at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:472)
          at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:295)
          at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:322)
          at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:307)
          at org.frouleau.kafka.clients.Produce.sendAvroSpecific(Produce.java:89)
          at org.frouleau.kafka.clients.Produce.main(Produce.java:63)

      This behavior was introduced by KAFKA-15901 implementing KIP-714.

      Attachments

        Issue Links

          Activity

            People

              fred-ro Fred Rouleau
              fred-ro Fred Rouleau
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 10m
                  10m
                  Remaining:
                  Remaining Estimate - 10m
                  10m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified