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

Chia-Ping Tsai commented on KAFKA-19990:
----------------------------------------


{code:scala}
      override def onComplete(response: ClientResponse): Unit = {
        val message = 
response.responseBody().asInstanceOf[AllocateProducerIdsResponse]
        handleAllocateProducerIdsResponse(message)
      }
{code}

yes, it results in NPE in 3.9.


{code:java}
                if (response.responseBody() instanceof 
AllocateProducerIdsResponse) {
                    
handleAllocateProducerIdsResponse((AllocateProducerIdsResponse) 
response.responseBody());
                }
{code}

The NPE seems to be resolved in 4.0+ due to the `instanceof`check. In spite of 
that, we should still prioritize dealing with the `authenticationException` and 
`versionMismatch`



> NPE on handling an AllocateProducerIdsResponse 
> -----------------------------------------------
>
>                 Key: KAFKA-19990
>                 URL: https://issues.apache.org/jira/browse/KAFKA-19990
>             Project: Kafka
>          Issue Type: Bug
>    Affects Versions: 3.9.1, 4.1.1
>            Reporter: Gaurav Narula
>            Assignee: Gaurav Narula
>            Priority: Major
>
> {{RPCProducerIdManager}} attempts to invoke 
> {{handleAllocateProducerIdsResponse}} without checks for 
> {{authenticationException}} and {{versionMismatch}} which can cause NPE at 
> {{response.data()}} since {{response}} might be {{null}}.
> Update: The NPE is only in the Scala implmentation of 
> {{RPCProducerIdManager}}. Trunk is not impacted by the NPE but the broker 
> will not retry the request on auth failure.



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

Reply via email to