You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Marco Lotz (Jira)" <ji...@apache.org> on 2021/02/03 18:35:00 UTC

[jira] [Comment Edited] (KAFKA-9527) Application Reset Tool Returns NPE when --to-timestamp or --by-duration are run on --input-topics with empty partitions

    [ https://issues.apache.org/jira/browse/KAFKA-9527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17278285#comment-17278285 ] 

Marco Lotz edited comment on KAFKA-9527 at 2/3/21, 6:34 PM:
------------------------------------------------------------

[~mjsax] I see your point. Indeed in this scenario makes more sense to notify the user about it.

The bug is caused because of this line [here|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java#L516] - that returns by default a null value on the map.
 The following method
{code:java}
client.seek(topicPartition, topicPartitionsAndOffset.get(topicPartition).offset());{code}




uses it as an argument call without optional handling - which indeed causes a NPE for keys with null values on the map.
 [~jbfletch] it think it should be straight forward to fix, do you mind if I assign the bug to me?


was (Author: marcolotz):
[~mjsax] I see your point. Indeed in this scenario makes more sense to notify the user about it.

The bug is caused because of this line [here|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java#L516] - that returns by default a null value on the map.
The following method

```java

client.seek(topicPartition, topicPartitionsAndOffset.get(topicPartition).offset());

```

uses it as an argument call without optional handling - which indeed causes a NPE for keys with null values on the map.
[~jbfletch] it think it should be straight forward to fix, do you mind if I assign the bug to me?

> Application Reset Tool Returns NPE when --to-timestamp or --by-duration are run on --input-topics with empty partitions 
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-9527
>                 URL: https://issues.apache.org/jira/browse/KAFKA-9527
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams, tools
>    Affects Versions: 2.3.0
>            Reporter: jbfletch
>            Assignee: jbfletch
>            Priority: Minor
>
> When running the streams application reset tool with --by-duration or --to-timestamp if any partitions for a given input topic are empty a NPE is thrown.  I tested this with a topic with 3 partitions, I received a NPE until all 3 partitions had at least one message.  The behavior was the same for both --to-timestamp and --by-duration. 
> Error below:
> Reset-offsets for input topics [sample-cdc-topic]Reset-offsets for input topics [sample-cdc-topic]Following input topics offsets will be reset to (for consumer group des-demo-stream)ERROR: java.lang.NullPointerExceptionjava.lang.NullPointerException at kafka.tools.StreamsResetter.resetToDatetime(StreamsResetter.java:496) at kafka.tools.StreamsResetter.maybeReset(StreamsResetter.java:426) at kafka.tools.StreamsResetter.maybeResetInputAndSeekToEndIntermediateTopicOffsets(StreamsResetter.java:374) at kafka.tools.StreamsResetter.run(StreamsResetter.java:164) at kafka.tools.StreamsResetter.run(StreamsResetter.java:131) at kafka.tools.StreamsResetter.main(StreamsResetter.java:678)
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)