You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/07/01 07:31:17 UTC

[GitHub] [kafka] ayoukhananov commented on a change in pull request #10951: KAFKA-12841: NPE from the provided metadata in client callback in case of ApiException

ayoukhananov commented on a change in pull request #10951:
URL: https://github.com/apache/kafka/pull/10951#discussion_r662049082



##########
File path: clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
##########
@@ -982,8 +982,12 @@ private void throwIfProducerClosed() {
             // for other exceptions throw directly
         } catch (ApiException e) {
             log.debug("Exception occurred during message send:", e);
-            if (callback != null)
-                callback.onCompletion(null, e);
+            // producer callback will make sure to call both 'callback' and interceptor callback
+            Callback interceptCallback = new InterceptorCallback<>(callback, this.interceptors, tp);

Review comment:
       I am not sure it covers the case KafkaException is thrown in line 913.
     throw new KafkaException("Producer closed while send in progress", e);
     
     Which means tp still not initialised and has the null value.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org