Uploaded image for project: 'Flume'
  1. Flume
  2. FLUME-3043

KafkaSink SinkCallback throws NullPointerException when Log4J level is debug

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.0
    • 1.8.0
    • Sinks+Sources
    • None

    Description

      When we send a event with SinkCallback to kafka under DEBUG level of log4j, if kafka reponses a result with exception but not a RecordMetadata. Kafka Sink will throw NPE.

      code in SinkCallback:

      if (logger.isDebugEnabled()) {
        long eventElapsedTime = System.currentTimeMillis() - startTime;
        logger.debug("Acked message partition:{} ofset:{}",  metadata.partition(), metadata.offset());
        logger.debug("Elapsed time for send: {}", eventElapsedTime);
      }
      

      code in Kafka Producer:

      if (exception == null) { 
        RecordMetadata metadata = new RecordMetadata(...);
        thunk.callback.onCompletion(metadata, null);
      } else {
        thunk.callback.onCompletion(null, exception);
      }
      

      Attachments

        1. FLUME-3043.patch
          0.9 kB
          dengkai

        Activity

          People

            lolee_k dengkai
            lolee_k dengkai
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: