[ 
https://issues.apache.org/jira/browse/KAFKA-17994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17898209#comment-17898209
 ] 

Ilya commented on KAFKA-17994:
------------------------------

Hi [~mjsax] . We use Kotlin and it doesnt have checked exceptions at compile 
time, so even deserializer like this would compile:
{code:java}
// kotlin
Deserializer { topic: String, bytes: ByteArray ->
    throw IOException("error")
} {code}
 

 

And the error in runtime would be exactly that without wrapping:
{code:java}
Exception in thread "main" java.io.IOException: error
...stack... {code}
 

I suppose, its the same problem for Scala. And its also technically possible in 
Java, see https://stackoverflow.com/a/37748872.

> Runtime exceptions are not handled when deserializing kafka stream record
> -------------------------------------------------------------------------
>
>                 Key: KAFKA-17994
>                 URL: https://issues.apache.org/jira/browse/KAFKA-17994
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>    Affects Versions: 3.9.0
>            Reporter: Ilya
>            Priority: Major
>
> When we got a PR to upgrade kafka clients 3.8.1 -> 3.9.0, we saw some failing 
> tests. They were relating to using a DeserializationExceptionHandler with 
> 'log and continue' strategy, however on newest version the stream was just 
> crashing when Jackson was trying to deserialize a faulty json and this 
> handler was not invoked.
> In this 
> [KIP-1033|https://cwiki.apache.org/confluence/display/KAFKA/KIP-1033%3A+Add+Kafka+Streams+exception+handler+for+exceptions+occurring+during+processing],
>  specifically in this PR 
> [https://github.com/apache/kafka/pull/16745/files#diff-77791b213bb41d1df63a23860f1faf4394dfbd7d6c4ed9cd021950d82c31c24f]
>  a change was introduced to catch only RuntimeException type and handle them 
> in the handler. However, all the Jackson exceptions inherit Exception type, 
> not RuntimeException - 
> https://fasterxml.github.io/jackson-core/javadoc/2.14/com/fasterxml/jackson/core/JacksonException.html
> So with this change all the Jackson exceptions (or any checked exceptions) 
> would not be passed to the DeserializationExceptionHandler like it was before.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to