You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2021/11/29 18:57:01 UTC

[GitHub] [hadoop] functioner commented on a change in pull request #3719: HADOOP-18024. SocketChannel is not closed when IOException happens in Server$Listener.doAccept

functioner commented on a change in pull request #3719:
URL: https://github.com/apache/hadoop/pull/3719#discussion_r758649585



##########
File path: hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java
##########
@@ -1536,9 +1536,19 @@ void doAccept(SelectionKey key) throws InterruptedException, IOException,  OutOf
       SocketChannel channel;
       while ((channel = server.accept()) != null) {
 
-        channel.configureBlocking(false);
-        channel.socket().setTcpNoDelay(tcpNoDelay);
-        channel.socket().setKeepAlive(true);
+        try {
+          channel.configureBlocking(false);
+          channel.socket().setTcpNoDelay(tcpNoDelay);
+          channel.socket().setKeepAlive(true);
+        } catch (IOException e) {
+          LOG.warn("Error in an accepted SocketChannel", e);
+          try {
+            channel.socket().close();
+            channel.close();
+          } catch (IOException ignored) {

Review comment:
       I've added the log in a new commit. Thanks




-- 
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: common-issues-unsubscribe@hadoop.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org