dajac commented on a change in pull request #11504:
URL: https://github.com/apache/kafka/pull/11504#discussion_r752997477



##########
File path: core/src/main/scala/kafka/network/SocketServer.scala
##########
@@ -734,6 +734,10 @@ private[kafka] class Acceptor(val endPoint: EndPoint,
         val endThrottleTimeMs = e.startThrottleTimeMs + e.throttleTimeMs
         throttledSockets += DelayedCloseSocket(socketChannel, 
endThrottleTimeMs)
         None
+      case e: IOException =>
+        info(s"Encounter IOException", e)
+        closeSocket(socketChannel)

Review comment:
       `testMaxConnectionsPerIpOverrides` might be a good starting point as it 
test something in the same area. Why do you think that we need to modify a log 
of code in `SocketServer`?
   
   If we extract `serverSocketChannel.accept()` into a method. Then, we can 
create a `SocketServer` and overwrite the method. In the method, we could 
return a mocked Socket which throws an exception when `configureBlocking` is 
called. Then, we could try to establish a connection. Finally, we can verify 
that the `close` methods were called.
   
   ```scala
   val overrideServer = new SocketServer(...) {
     override def accept(): Socket = {
   
     }
   }
   ```
   
   




-- 
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-unsubscr...@kafka.apache.org

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


Reply via email to