You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "joseph m'bimbi-bene (Jira)" <ji...@apache.org> on 2020/05/04 15:20:00 UTC

[jira] [Updated] (CAMEL-14980) camel-kafka - SerializationException - consumer keeps leaving and rejoining the group

     [ https://issues.apache.org/jira/browse/CAMEL-14980?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

joseph m'bimbi-bene updated CAMEL-14980:
----------------------------------------
    Description: 
Hello everyone,

 

I found out i few days ago that if a `SerializationException` is thrown when the consumer tries to poll messages, it will keep leaving and joining the consumer-group indefinitely and without any informative log.
 The exception cannot either be handled by any camel exception handler.

After some searching in the code i found out the culprit:
{code:java}
// org.apache.camel.component.kafka.KafkaConsumer (ligns 406-415):
catch (KafkaException e) {
  // some kind of error in kafka, it may happen during
  // unsubscribing or during normal processing
  if (unsubscribing){             
    getExceptionHandler().handleException("Error unsubscribing " + threadId + " from kafka topic " + topicName, e);   
  }else {
    LOG.debug("KafkaException consuming {} from topic {} causedby {}. Will attempt to re-connect on next run", threadId, topicName, e.getMessage());
    reConnect = true;
  }
}
{code}
 

`SerializationException` extends from `KafkaException`, but it is definitely not a recoverable exception.

It logs with debug level, which makes it hard to track, there are SO many things logging in debug.

It it cannot be handled by any camel exception handling mechanism.

I think it would be better to either:
 - change that catch so that it pinpoints the subclasses of `KafkaException` that are actually recoverable from rejoining (maybe `WakeupException` and a couple others)
 - add a `catch` block for `SerializationException` and maybe `ConfigException` and `OAuthBearerConfigException` before, with a log error andallow the user to handle those exceptions
 - remove that catch block entirely and let users handle any KafkaException however they see fit.

Thank you

  was:
Hello everyone,

 

I found out i few days ago that if a `SerializationException` is thrown when the consumer tries to poll messages, it will keep leaving and joining the consumer-group indefinitely and without any informative log.
 The exception cannot either be handled by any camel exception handler.

After some searching in the code i found out the culprit:

``` java
{code:java}
// org.apache.camel.component.kafka.KafkaConsumer (ligns 406-415):
catch (KafkaException e) {
  // some kind of error in kafka, it may happen during
  // unsubscribing or during normal processing
  if (unsubscribing){             
    getExceptionHandler().handleException("Error unsubscribing " + threadId + " from kafka topic " + topicName, e);   
  }else {
    LOG.debug("KafkaException consuming {} from topic {} causedby {}. Will attempt to re-connect on next run", threadId, topicName, e.getMessage());
    reConnect = true;
  }
}
{code}

 ```

`SerializationException` extends from `KafkaException`, but it is definitely not a recoverable exception.

It logs with debug level, which makes it hard to track, there are SO many things logging in debug.

It it cannot be handled by any camel exception handling mechanism.

I think it would be better to either:
 - change that catch so that it pinpoints the subclasses of `KafkaException` that are actually recoverable from rejoining (maybe `WakeupException` and a couple others)
 - add a `catch` block for `SerializationException` and maybe `ConfigException` and `OAuthBearerConfigException` before, with a log error andallow the user to handle those exceptions
 - remove that catch block entirely and let users handle any KafkaException however they see fit.

Thank you


> camel-kafka - SerializationException - consumer keeps leaving and rejoining the group
> -------------------------------------------------------------------------------------
>
>                 Key: CAMEL-14980
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14980
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-kafka
>    Affects Versions: 3.2.0
>            Reporter: joseph m'bimbi-bene
>            Assignee: Ramu
>            Priority: Major
>             Fix For: 3.3.0
>
>
> Hello everyone,
>  
> I found out i few days ago that if a `SerializationException` is thrown when the consumer tries to poll messages, it will keep leaving and joining the consumer-group indefinitely and without any informative log.
>  The exception cannot either be handled by any camel exception handler.
> After some searching in the code i found out the culprit:
> {code:java}
> // org.apache.camel.component.kafka.KafkaConsumer (ligns 406-415):
> catch (KafkaException e) {
>   // some kind of error in kafka, it may happen during
>   // unsubscribing or during normal processing
>   if (unsubscribing){             
>     getExceptionHandler().handleException("Error unsubscribing " + threadId + " from kafka topic " + topicName, e);   
>   }else {
>     LOG.debug("KafkaException consuming {} from topic {} causedby {}. Will attempt to re-connect on next run", threadId, topicName, e.getMessage());
>     reConnect = true;
>   }
> }
> {code}
>  
> `SerializationException` extends from `KafkaException`, but it is definitely not a recoverable exception.
> It logs with debug level, which makes it hard to track, there are SO many things logging in debug.
> It it cannot be handled by any camel exception handling mechanism.
> I think it would be better to either:
>  - change that catch so that it pinpoints the subclasses of `KafkaException` that are actually recoverable from rejoining (maybe `WakeupException` and a couple others)
>  - add a `catch` block for `SerializationException` and maybe `ConfigException` and `OAuthBearerConfigException` before, with a log error andallow the user to handle those exceptions
>  - remove that catch block entirely and let users handle any KafkaException however they see fit.
> Thank you



--
This message was sent by Atlassian Jira
(v8.3.4#803005)