akhileshchg commented on code in PR #21740:
URL: https://github.com/apache/kafka/pull/21740#discussion_r2934185019


##########
core/src/main/scala/kafka/network/SocketServer.scala:
##########
@@ -1047,6 +1050,9 @@ private[kafka] class Processor(
         // note that even though we got an exception, we can assume that 
receive.source is valid.
         // Issues with constructing a valid receive object were handled earlier
         case e: Throwable =>
+          if (header == null || req == null || 
header.apiKey.requiresDelayedAllocation) {
+             receive.close() // return buffer to memory pool

Review Comment:
   receive.close() itself is safe from double free since the buffer is set to 
null after release. Can we add an else in the NetworkReceive and log any 
attempts to double-free to catch potential bugs. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to