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

KafkaSink SinkCallback throws NullPointerException when Log4J level is debug

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.0
    • Fix Version/s: 1.8.0
    • Component/s: Sinks+Sources
    • Labels:
      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

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: