You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Richard Joerger (Jira)" <ji...@apache.org> on 2022/06/06 19:46:00 UTC

[jira] [Commented] (KAFKA-13908) RuntimeException will be thrown in BrokerServer.startup, not the cause of exception

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

Richard Joerger commented on KAFKA-13908:
-----------------------------------------

Hey [~showuon], I'm taking a look at this issue and I suppose I'm a little bit confused on the reported issue, perhaps I'm just being a little bone headed. 

 

As I understand it, in the BrokerServer.scala a change was not made where we will throw the cause, but instead throw the full exception. Fixing the logic for the throw is fine but I'm unsure about how best to test this process in an automated way. To put it simply, I'm not sure how we would create a KafkaStorageException that gets caught in the BrokerServer.scala code. Would you happen to know of any tests which would serve as a good point of reference to for this process? 

> RuntimeException will be thrown in BrokerServer.startup, not the cause of exception
> -----------------------------------------------------------------------------------
>
>                 Key: KAFKA-13908
>                 URL: https://issues.apache.org/jira/browse/KAFKA-13908
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Luke Chen
>            Assignee: Richard Joerger
>            Priority: Major
>              Labels: newbie
>
> Before [#11969|https://github.com/apache/kafka/pull/11969], We will throw an {{ExecutionException(KafkaStorageException)}} in {{{}BrokerServer.startup{}}}, and we'll catch the exception and rethrow the cause by:
> {code:java}
> throw if (e.isInstanceOf[ExecutionException]) e.getCause else e{code}
> [https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/Kafka.scala#L113]
>  
> After [#11969|https://github.com/apache/kafka/pull/11969], We will throw a {{{}RuntimeException(ExecutionException(KafkaStorageException)){}}}. But the catch logic didn't change. That means, if the exception is RuntimeException, we won't throw only the cause, but all the exception chains. 
>  
> We should update it and add tests for it.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)