showuon commented on pull request #10794:
URL: https://github.com/apache/kafka/pull/10794#issuecomment-864374754


   @hachikuji , I checked and there's no race condition there. The reason why 
we didn't put `NOT_CONTROLLER` in EnvelopResponse itself is because we will 
build envelopeResponse **with no error** as long as we got response from 
handler (createTopics handler in this case) 
[here](https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/network/RequestChannel.scala#L124).
 So, in `ControllerApi#handleCreateTopics`, we'll sendResponse when future 
completed, and then `RequestHandlerHelper#sendResponseMaybeThrottle`, we'll 
`buildResponseSend` and then go to the above link location. 
   
   So, to fix this issue, I need to build EnvelopeResponse with 
`NotControllerError` when the response from handler is having 
`NotControllerError` (fix 2). But if we don't have (fix 1), we can only get 
`Unknown_Server_Error` in the response from handler because the 
`NotControllerError` is wrapped with `CompletionException`.
   
   That's my solution. Please help review. Thank you very much!


-- 
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.

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


Reply via email to