Hi all, I have a Flink SQL stream using the kafka ...
# troubleshooting
h
Hi all, I have a Flink SQL stream using the kafka connector. For example: `CREATE TABLE
T24SB.ODS_STMT_ENTRY
(`
TRANSACTION_TIME AS PROCTIME() ,
RECID STRING,
COMMIT_SCN DOUBLE,
COMMIT_ACTION STRING,
ACCOUNT_NUMBER DOUBLE,
COMPANY_CODE STRING,
AMOUNT_LCY DOUBLE
)
WITH (
'connector' = 'kafka',
'topic' = 'ODS_STMT_ENTRY_FLINK',
'scan.startup.mode' = 'latest-offset',
--'scan.startup.timestamp-millis' = '1705517843000',
'format' = 'avro-confluent',
'avro-confluent.url' = 'http://dc1-dev-kkschm01.seauat.com.vn:8081',
...
);
The application was running fine until a message with the wrong format (for example,
ACCOUNT_NUMBER
was a number but the input contained letters) caused the job to stop working and could not be restarted despite trying. How to remove these error messages and save the content or ID/offset of the error message. Or is there a better way to handle it?
d
You need to indicate the version of Flink you are using and also share error message you are getting. Provide enough information to get information please
You may need to read the log file for the job manager to find the exact messages
h
@D. Draco O'Brien I'm reading the kafka stream using confluent-avro but for some reason, there's a message that's causing it to fail
java.io.IOException: Failed to deserialize consumer record due to
at org.apache.flink.connector.kafka.source.reader.KafkaRecordEmitter.emitRecord(KafkaRecordEmitter.java:56)
at org.apache.flink.connector.kafka.source.reader.KafkaRecordEmitter.emitRecord(KafkaRecordEmitter.java:33)
at org.apache.flink.connector.base.source.reader.SourceReaderBase.pollNext(SourceReaderBase.java:160)
at org.apache.flink.streaming.api.operators.SourceOperator.emitNext(SourceOperator.java:419)
at org.apache.flink.streaming.runtime.io.StreamTaskSourceInput.emitNext(StreamTaskSourceInput.java:68)
at org.apache.flink.streaming.runtime.io.StreamOneInputProcessor.processInput(StreamOneInputProcessor.java:65)
at org.apache.flink.streaming.runtime.tasks.StreamTask.processInput(StreamTask.java:562)
at org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.runMailboxLoop(MailboxProcessor.java:231)
at org.apache.flink.streaming.runtime.tasks.StreamTask.runMailboxLoop(StreamTask.java:858)
at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:807)
at org.apache.flink.runtime.taskmanager.Task.runWithSystemExitMonitoring(Task.java:953)
at org.apache.flink.runtime.taskmanager.Task.restoreAndInvoke(Task.java:932)
at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:746)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:562)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.IOException: Failed to deserialize consumer record ConsumerRecord(topic = ODS_FUNDS_TRANSFER_FLINK, partition = 1, leaderEpoch = 43, offset = 640914, LogAppendTime = 1709083681328, serialized key size = 2, serialized value size = 3159, headers = RecordHeaders(headers = [], isReadOnly = false), key = [B@7291a716, value = [B@ac47ad0).
at org.apache.flink.connector.kafka.source.reader.deserializer.KafkaDeserializationSchemaWrapper.deserialize(KafkaDeserializationSchemaWrapper.java:57)
at org.apache.flink.connector.kafka.source.reader.KafkaRecordEmitter.emitRecord(KafkaRecordEmitter.java:53)
... 14 more
Caused by: java.io.IOException: Failed to deserialize Avro record.
at org.apache.flink.formats.avro.AvroRowDataDeserializationSchema.deserialize(AvroRowDataDeserializationSchema.java:106)
at org.apache.flink.formats.avro.AvroRowDataDeserializationSchema.deserialize(AvroRowDataDeserializationSchema.java:46)
at org.apache.flink.api.common.serialization.DeserializationSchema.deserialize(DeserializationSchema.java:82)
at org.apache.flink.streaming.connectors.kafka.table.DynamicKafkaDeserializationSchema.deserialize(DynamicKafkaDeserializationSchema.java:113)
at org.apache.flink.connector.kafka.source.reader.deserializer.KafkaDeserializationSchemaWrapper.deserialize(KafkaDeserializationSchemaWrapper.java:54)
... 15 more
Caused by: java.io.IOException: Unknown data format. Magic number does not match
And it causes the flink job to fail and cannot be restarted. I want to ask how to make flink ignore these messages to continue the job and if possible, store error messages with some exception.
d
Magic numbrers usually refer JDK version mismatch with the jar files in use. You need to check your JDK version where connector is runniing as well as the versions of the jar files. See also https://dcbl.link/flink-sql-f18e25 for details on how to determine correct Jar files for your configuration. In your case I suspect that you are either using the wrong version of JDK or Kafka-Connect onnector jar file for your Flink version
Please determine JDK Version, Kafka Connect Jar Version, etc as outlined.
h
@D. Draco O'Brien i think i'm in the same situation as https://issues.apache.org/jira/browse/FLINK-20091. I need something like 'avro.ignore-parse-errors'
d
Are you using Confluent Avro Deserializer? and if so what version of it?
This appears to maybe address it. What version of Flink are you using.? The issue mentioned here was in 2019 and clsoed out. Alwyas good to provide flink version numbers and any othrer information related to your question
h
I use flink 1.18 and confluent 3.2.1
Thanks for your help. I will try it and let me know if there is any other solution
d
1.18.1?
h
it's 1.18.0
d
Ok, I dont really think that makes a difference here but it is recommended to upgrade to 1.18.1
h
Ok, I still have a lot of development
j
@D. Draco O'Brien This isn't working with Flink 1.18.1.