[ https://issues.apache.org/jira/browse/KAFKA-12841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17372989#comment-17372989 ]
Avi Youkhananov edited comment on KAFKA-12841 at 7/1/21, 6:31 PM: ------------------------------------------------------------------ [~kirktrue] This is what i did in this [[PR|https://github.com/apache/kafka/pull/10728]]. Might be the right approach is to create the tp with default values was (Author: ayouk): [~kirktrue] This is what i did in this [PR|[pr|https://github.com/apache/kafka/pull/10728]]. Might be the right approach is to create the tp with default values > NPE from the provided metadata in client callback in case of ApiException > ------------------------------------------------------------------------- > > Key: KAFKA-12841 > URL: https://issues.apache.org/jira/browse/KAFKA-12841 > Project: Kafka > Issue Type: Bug > Components: clients > Affects Versions: 2.6.0 > Environment: Prod > Reporter: Avi Youkhananov > Priority: Major > Attachments: NPE.production > > > 1. > org.apache.kafka.clients.producer.Callback interface has method > onCompletion(...) > Which says as part of the documentation : > *The metadata for the record that was sent (i.e. the partition and offset). > *An empty metadata with -1 value for all fields* except for topicPartition > will be returned if an error occurred. > We got an NPE from doSend(...) method in > org.apache.kafka.clients.producer.KafkaProducer > Which can occur in case ApiException was thrown ... > In case of ApiException it uses the regular callback instead of > InterceptorCallback which also may cover the NPE. > 2. More over RecordMetadata has method partition() which return int but can > also throw NPE because TopicPartition might be null. > Stack trace attached. > -- This message was sent by Atlassian Jira (v8.3.4#803005)