Return-Path: X-Original-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 502BC6362 for ; Fri, 8 Jul 2011 23:38:39 +0000 (UTC) Received: (qmail 20169 invoked by uid 500); 8 Jul 2011 23:38:39 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 20143 invoked by uid 500); 8 Jul 2011 23:38:38 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 20135 invoked by uid 99); 8 Jul 2011 23:38:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jul 2011 23:38:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jul 2011 23:38:37 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id AF32D4E25A for ; Fri, 8 Jul 2011 23:38:16 +0000 (UTC) Date: Fri, 8 Jul 2011 23:38:16 +0000 (UTC) From: "Hudson (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: <31452633.13006.1310168296714.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <580318076.2659.1307975871528.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (HDFS-2071) Use of isConnected() in DataXceiver is invalid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-2071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13062251#comment-13062251 ] Hudson commented on HDFS-2071: ------------------------------ Integrated in Hadoop-Hdfs-22-branch #70 (See [https://builds.apache.org/job/Hadoop-Hdfs-22-branch/70/]) > Use of isConnected() in DataXceiver is invalid > ---------------------------------------------- > > Key: HDFS-2071 > URL: https://issues.apache.org/jira/browse/HDFS-2071 > Project: Hadoop HDFS > Issue Type: Bug > Components: data-node > Affects Versions: 0.23.0 > Reporter: Kihwal Lee > Assignee: Kihwal Lee > Priority: Minor > Fix For: 0.22.0 > > Attachments: HDFS-2071.patch > > > The use of Socket.isConnected() in DataXceiver.run() is not valid. It returns false until the connection is made and then always returns true after that. It will never return false after the initial connection is successfully made. Socket.isClosed() or SocketChannel.isOpen() should be used instead, assuming someone is handling SocketException and does Socket.close() or SocketChannel.close(). It seems the op handlers in DataXceiver are diligently using IOUtils.closeStream(), which will invoke SocketChannel.close(). > {code} > - } while (s.isConnected() && socketKeepaliveTimeout > 0); > + } while (!s.isClosed() && socketKeepaliveTimeout > 0); > {code} > The effect of this bug is very minor, as the socket is read again right after. If the connection was closed, the readOp() will throw an EOFException, which is caught and dealt with properly. The system still functions normally with probably only few microseconds of extra overhead in the premature connection closure cases. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira