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

KafkaSink SinkCallback throws NullPointerException when Log4J level is debug

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment