[
https://issues.apache.org/jira/browse/FLUME-3043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15946958#comment-15946958
]
ASF GitHub Bot commented on FLUME-3043:
---------------------------------------
GitHub user loleek opened a pull request:
https://github.com/apache/flume/pull/125
bugfix: when loglevel is debug, Kafka Sink will throw NPE because of …
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);
}
I've already created this issue on jira.
https://issues.apache.org/jira/browse/FLUME-3043?jql=project%20%3D%20FLUME
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/loleek/flume npe-kafka-sink
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flume/pull/125.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #125
----
commit dcad5ff6651c4c1714ebb7c9fae29d377096f48e
Author: dengkai02 <[email protected]>
Date: 2017-03-29T11:27:29Z
bugfix: when loglevel is debug, Kafka Sink will throw NPE because of
metadata can be null
----
> KafkaSink SinkCallback throws NullPointerException when Log4J level is debug
> ----------------------------------------------------------------------------
>
> Key: FLUME-3043
> URL: https://issues.apache.org/jira/browse/FLUME-3043
> Project: Flume
> Issue Type: Bug
> Components: Sinks+Sources
> Affects Versions: 1.7.0
> Reporter: dengkai
> Assignee: dengkai
> Attachments: FLUME-3043.patch
>
>
> 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:
> {code}
> 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}
> code in Kafka Producer:
> {code}
> if (exception == null) {
> RecordMetadata metadata = new RecordMetadata(...);
> thunk.callback.onCompletion(metadata, null);
> } else {
> thunk.callback.onCompletion(null, exception);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)