question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KStreamListenerParameterAdapter crashes with NPE on Kafka tombstones records

See original GitHub issue

Recently I’ve been working with a Kafka Connect connector (Debezium Mongo) which by default is utilising the Kafka topic compaction, it was not a desired behaviour for my use case so I’ve submitted a PR to their repository (worth checking as it will show how I got to the error I’m about to describe https://github.com/debezium/debezium/pull/421)

The problem is that KStreamListenerParameterAdapter will not handle kafka tombstones records properly and it will crash with NullPointerException when it tries to consume a kafka message which is a tombstone.

		return bindingTarget.map(new KeyValueMapper() {
			@Override
			public Object apply(Object o, Object o2) {
				if (valueClass.isAssignableFrom(o2.getClass())) {
					return new KeyValue<>(o, o2);
				}

the o2.getClass() will generate NPE

Here is the snapshot from the topic, first message is a delete operation, the second one is the tombstone null associated (and generated) with this delete message. 1-1

And here’s where the explosion is about to happen: 2

Detected in: package: org.springframework.cloud.stream.binder.kstream class: KStreamListenerParameterAdapter maven co-ords to the jar: org.springframework.cloud:spring-cloud-stream-binder-kstream11:1.3.0.RELEASE

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sobychackocommented, Jan 30, 2018

@rliwoch Thanks for reporting this. It looks like this is a bug. We will filter out null values in the adapter as you cannot do any stream processing on that anyway. Will try to fix it in the 2.0 timeline. Any further feedback or better yet contributions are welcomed! Thank you.

0reactions
sabbyanandancommented, Jan 31, 2018

This issue was moved to spring-cloud/spring-cloud-stream-binder-kafka#294

Read more comments on GitHub >

github_iconTop Results From Across the Web

KStreamListenerParameterAdapter crashes with NPE on Kafka ...
The problem is that KStreamListenerParameterAdapter will not handle kafka tombstones records properly and it will crash with NullPointerException when it tries ...
Read more >
Kafka Streams restoration crashes with NPE when the record ...
A scenario you could reproduce is like: Having a source KTable (timestampedKeyValueStore) reads in tombstone records where the value field is ...
Read more >
Kafka streams GlobalKTable throws Deserialization exception ...
When I push a Tombstone record to the topic (Non-empty key with null value) - my Kafka streams application fails with Deserialization ...
Read more >
Deleting records in Kafka (aka tombstones) - Medium
In this blog post, I will thoroughly explain technical details about the process of deleting records in Kafka (aka tombstones).
Read more >
TombstoneHandler | Confluent Documentation
The connector uses the fail behavior to handle tombstone records, which fails the execution, throws a DataException , and writes a DEBUG message...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found