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 D25BD44D5 for ; Wed, 15 Jun 2011 20:15:08 +0000 (UTC) Received: (qmail 82472 invoked by uid 500); 15 Jun 2011 20:15:08 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 82435 invoked by uid 500); 15 Jun 2011 20:15:08 -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 82427 invoked by uid 99); 15 Jun 2011 20:15:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jun 2011 20:15:08 +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; Wed, 15 Jun 2011 20:15:07 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 851EF41A6FD for ; Wed, 15 Jun 2011 20:14:47 +0000 (UTC) Date: Wed, 15 Jun 2011 20:14:47 +0000 (UTC) From: "Kihwal Lee (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: <917180293.8285.1308168887542.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=13049994#comment-13049994 ] Kihwal Lee commented on HDFS-2071: ---------------------------------- Test failures: * TestHDFSCLI: The quota related test failures are not due to this patch. They also failed in build #696. * TestHDFSTrash : It was failing in other recent pre-commit builds: e.g. https://builds.apache.org/job/PreCommit-HDFS-Build/786/ Tests included: No test is included as justified above. > 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.20.3 > > 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