You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "A. Sophie Blee-Goldman (Jira)" <ji...@apache.org> on 2021/08/26 02:43:00 UTC
[jira] [Commented] (KAFKA-12963) Improve error message for Class
cast exception
[ https://issues.apache.org/jira/browse/KAFKA-12963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17404853#comment-17404853 ]
A. Sophie Blee-Goldman commented on KAFKA-12963:
------------------------------------------------
Hey [~RasmusAtNordea], just to clarify the ask here is to add the processor name to this exception message? I don't think that was ever in there so I wouldn't say it's a regression, but I definitely agree that should have been in there. Is there anything else you can think of that would have been helpful in debugging this?
The one thing I'm not sure makes sense is the topic – what topic would that be? The processors themselves aren't attached to any specific topic, except of course a source or a sink. But I think maybe you meant, which topic did the record come from? The problem is, even that doesn't exactly have an answer. For one thing, the ClassCastException may have come from anywhere – could just be a bug in the processing logic itself, unattached to any specific record. Of course there's the specific record that #process is being called on, but maybe you have two different topics feeding into this processor and the ClassCastException was actually due to a record from the other topic that was just fetched from an attached state store. Or maybe the record being processed was created by a punctuator and never came from any topic at all. And so on...sorry for the long-winded way of saying that there's actually a reason for the topic info being left out, unlike the processor name which definitely should be included. Hope that makes sense?
> Improve error message for Class cast exception
> ----------------------------------------------
>
> Key: KAFKA-12963
> URL: https://issues.apache.org/jira/browse/KAFKA-12963
> Project: Kafka
> Issue Type: Improvement
> Components: streams
> Affects Versions: 2.7.0
> Reporter: Rasmus Helbig Hansen
> Assignee: A. Sophie Blee-Goldman
> Priority: Minor
>
> After a topology change and starting the application again, we got this type of error message:
> [g9z-StreamThread-1] ERROR org.apache.kafka.streams.processor.internals.TaskManager - stream-thread [g9z-StreamThread-1] Failed to process stream task 1_12 due to the following error:
> org.apache.kafka.streams.errors.StreamsException: ClassCastException invoking Processor. Do the Processor's input types match the deserialized types? Check the Serde setup and change the default Serdes in StreamConfig or provide correct Serdes via method parameters. Make sure the Processor can accept the deserialized input of type key: org.acme.SomeKey, and value: org.acme.SomeValue.
> Note that although incorrect Serdes are a common cause of error, the cast exception might have another cause (in user code, for example). For example, if a processor wires in a store, but casts the generics incorrectly, a class cast exception could be raised during processing, but the cause would not be wrong Serdes.
> at org.apache.kafka.streams.processor.internals.ProcessorNode.process(ProcessorNode.java:185)
> at org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forwardInternal(ProcessorContextImpl.java:273)
> at org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forward(ProcessorContextImpl.java:252)
> at org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forward(ProcessorContextImpl.java:219)
> at org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forward(ProcessorContextImpl.java:172)
> at org.apache.kafka.streams.kstream.internals.KStreamJoinWindow$KStreamJoinWindowProcessor.process(KStreamJoinWindow.java:55)
> at org.apache.kafka.streams.processor.internals.ProcessorAdapter.process(ProcessorAdapter.java:71)
> at org.apache.kafka.streams.processor.internals.ProcessorNode.lambda$process$2(ProcessorNode.java:181)
> at org.apache.kafka.streams.processor.internals.metrics.StreamsMetricsImpl.maybeMeasureLatency(StreamsMetricsImpl.java:883)
> at org.apache.kafka.streams.processor.internals.ProcessorNode.process(ProcessorNode.java:181)
> at org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forwardInternal(ProcessorContextImpl.java:273)
> at org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forward(ProcessorContextImpl.java:252)
> at org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forward(ProcessorContextImpl.java:219)
> at org.apache.kafka.streams.processor.internals.SourceNode.process(SourceNode.java:86)
> at org.apache.kafka.streams.processor.internals.StreamTask.lambda$process$1(StreamTask.java:703)
> at org.apache.kafka.streams.processor.internals.metrics.StreamsMetricsImpl.maybeMeasureLatency(StreamsMetricsImpl.java:883)
> at org.apache.kafka.streams.processor.internals.StreamTask.process(StreamTask.java:703)
> at org.apache.kafka.streams.processor.internals.TaskManager.process(TaskManager.java:1105)
> at org.apache.kafka.streams.processor.internals.StreamThread.runOnce(StreamThread.java:647)
> at org.apache.kafka.streams.processor.internals.StreamThread.runLoop(StreamThread.java:553)
> at org.apache.kafka.streams.processor.internals.StreamThread.run(StreamThread.java:512)
> Caused by: java.lang.ClassCastException: class org.acme.SomeValue cannot be cast to class org.acme.OtherValue (org.acme.SomeValue and org.acme.OtherValue are in unnamed module of loader 'app')
> at org.apache.kafka.streams.kstream.internals.KStreamKStreamJoin$KStreamKStreamJoinProcessor.process(KStreamKStreamJoin.java:112)
> at org.apache.kafka.streams.processor.internals.ProcessorAdapter.process(ProcessorAdapter.java:71)
> at org.apache.kafka.streams.processor.internals.ProcessorNode.lambda$process$2(ProcessorNode.java:181)
> at org.apache.kafka.streams.processor.internals.metrics.StreamsMetricsImpl.maybeMeasureLatency(StreamsMetricsImpl.java:883)
> at org.apache.kafka.streams.processor.internals.ProcessorNode.process(ProcessorNode.java:181)
> ... 20 more
> [g9z-StreamThread-1] ERROR org.apache.kafka.streams.processor.internals.StreamThread - stream-thread [g9z-StreamThread-1] Encountered the following exception during processing and the thread is going to shut down:
> org.apache.kafka.streams.errors.StreamsException: ClassCastException invoking Processor. Do the Processor's input types match the deserialized types? Check the Serde setup and change the default Serdes in StreamConfig or provide correct Serdes via method parameters. Make sure the Processor can accept the deserialized input of type key: org.acme.SomeKey, and value: org.acme.SomeValue.
> Note that although incorrect Serdes are a common cause of error, the cast exception might have another cause (in user code, for example). For example, if a processor wires in a store, but casts the generics incorrectly, a class cast exception could be raised during processing, but the cause would not be wrong Serdes.
>
> It doesn't give enough context, like processor name and topic, which made troubleshooting unnecessary tricky.
>
> Very similar to KAFKA-8884 which was fixed in 2.4.0. It seems like a regression.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)