You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Will Bartlett <wi...@gmail.com> on 2021/06/08 14:51:29 UTC

Issue with StreamsBuilder.stream(Pattern)

Hi all,

I'm hitting a NPE in a very basic repro. It happens when toString() is
called on the StreamSourceNode. It is just in logging code (debug), so no
real issue.

Essentially:

val builder = StreamsBuilder()
builder.stream(Pattern.compile("foo"), Consumed.with(Serdes.ByteArray(),
Serdes.ByteArray()))
val streams = KafkaStreams(builder.build(), Properties())
streams.start()

I had a look into it, and it seems like a bug.

StreamSourceNode.toString() calls topicNames():

https://github.com/apache/kafka/blob/1dadb6db0c6848a8a1d2eee1497f9b79b6e04e0e/streams/src/main/java/org/apache/kafka/streams/kstream/internals/graph/StreamSourceNode.java#L64-L70

Which will be null if constructed with a Pattern rather than a String:

https://github.com/apache/kafka/blob/1dadb6db0c6848a8a1d2eee1497f9b79b6e04e0e/streams/src/main/java/org/apache/kafka/streams/kstream/internals/graph/SourceGraphNode.java#L49

Which causes UnmodifiableCollection to throw.

I couldn't find any mention of the issue, and git blame suggests it is not
a recent change - so I am not sure. I am also very new to the jvm so my
confidence is low.

Happy to open a JIRA ticket if someone confirms :)

Thanks,

Will

Re: Issue with StreamsBuilder.stream(Pattern)

Posted by Will Bartlett <wi...@gmail.com>.
Hi Bruno,

Thanks for the quick reply.

https://issues.apache.org/jira/browse/KAFKA-12914

Will

On Tue, 8 Jun 2021 at 16:21, Bruno Cadonna <ca...@apache.org> wrote:

> Hi Will,
>
> This looks like a bug to me.
>
> Could you please open a Jira with the stacktrace of the exception and a
> minimal repro example?
>
> Best,
> Bruno
>
> On 08.06.21 16:51, Will Bartlett wrote:
> > Hi all,
> >
> > I'm hitting a NPE in a very basic repro. It happens when toString() is
> > called on the StreamSourceNode. It is just in logging code (debug), so no
> > real issue.
> >
> > Essentially:
> >
> > val builder = StreamsBuilder()
> > builder.stream(Pattern.compile("foo"), Consumed.with(Serdes.ByteArray(),
> > Serdes.ByteArray()))
> > val streams = KafkaStreams(builder.build(), Properties())
> > streams.start()
> >
> > I had a look into it, and it seems like a bug.
> >
> > StreamSourceNode.toString() calls topicNames():
> >
> >
> https://github.com/apache/kafka/blob/1dadb6db0c6848a8a1d2eee1497f9b79b6e04e0e/streams/src/main/java/org/apache/kafka/streams/kstream/internals/graph/StreamSourceNode.java#L64-L70
> >
> > Which will be null if constructed with a Pattern rather than a String:
> >
> >
> https://github.com/apache/kafka/blob/1dadb6db0c6848a8a1d2eee1497f9b79b6e04e0e/streams/src/main/java/org/apache/kafka/streams/kstream/internals/graph/SourceGraphNode.java#L49
> >
> > Which causes UnmodifiableCollection to throw.
> >
> > I couldn't find any mention of the issue, and git blame suggests it is
> not
> > a recent change - so I am not sure. I am also very new to the jvm so my
> > confidence is low.
> >
> > Happy to open a JIRA ticket if someone confirms :)
> >
> > Thanks,
> >
> > Will
> >
>

Re: Issue with StreamsBuilder.stream(Pattern)

Posted by Bruno Cadonna <ca...@apache.org>.
Hi Will,

This looks like a bug to me.

Could you please open a Jira with the stacktrace of the exception and a 
minimal repro example?

Best,
Bruno

On 08.06.21 16:51, Will Bartlett wrote:
> Hi all,
> 
> I'm hitting a NPE in a very basic repro. It happens when toString() is
> called on the StreamSourceNode. It is just in logging code (debug), so no
> real issue.
> 
> Essentially:
> 
> val builder = StreamsBuilder()
> builder.stream(Pattern.compile("foo"), Consumed.with(Serdes.ByteArray(),
> Serdes.ByteArray()))
> val streams = KafkaStreams(builder.build(), Properties())
> streams.start()
> 
> I had a look into it, and it seems like a bug.
> 
> StreamSourceNode.toString() calls topicNames():
> 
> https://github.com/apache/kafka/blob/1dadb6db0c6848a8a1d2eee1497f9b79b6e04e0e/streams/src/main/java/org/apache/kafka/streams/kstream/internals/graph/StreamSourceNode.java#L64-L70
> 
> Which will be null if constructed with a Pattern rather than a String:
> 
> https://github.com/apache/kafka/blob/1dadb6db0c6848a8a1d2eee1497f9b79b6e04e0e/streams/src/main/java/org/apache/kafka/streams/kstream/internals/graph/SourceGraphNode.java#L49
> 
> Which causes UnmodifiableCollection to throw.
> 
> I couldn't find any mention of the issue, and git blame suggests it is not
> a recent change - so I am not sure. I am also very new to the jvm so my
> confidence is low.
> 
> Happy to open a JIRA ticket if someone confirms :)
> 
> Thanks,
> 
> Will
>