You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Pierre Zemb (JIRA)" <ji...@apache.org> on 2019/05/04 11:56:00 UTC

[jira] [Created] (FLINK-12400) NullpointerException using SimpleStringSchema with Kafka

Pierre Zemb created FLINK-12400:
-----------------------------------

             Summary: NullpointerException using SimpleStringSchema with Kafka
                 Key: FLINK-12400
                 URL: https://issues.apache.org/jira/browse/FLINK-12400
             Project: Flink
          Issue Type: Improvement
          Components: API / Type Serialization System
    Affects Versions: 1.8.0, 1.7.2
         Environment: Flink 1.7.2 job on 1.8 cluster
Kafka 0.10 with a topic in log-compaction
            Reporter: Pierre Zemb
            Assignee: Pierre Zemb


Hi!

Yesterday, we saw a strange behavior with our Flink job and Kafka. We are consuming a Kafka topic setup in [log-compaction|https://kafka.apache.org/documentation/#compaction] mode. As such, sending a message with a null payload acts like a tombstone.

We are consuming Kafka like this:

{code:java}
new FlinkKafkaConsumer010<>  ("topic", new SimpleStringSchema(), this.kafkaProperties)
{code}

When we sent the message, job failed because of a NullPointerException [here|https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/api/common/serialization/SimpleStringSchema.java#L75]. `byte[] message` was null, causing the NPE. 

We forked the class and added a basic nullable check, returning null if so. It fixed our issue. 

Should we add it to the main class?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)