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 B7DB110EC3 for ; Tue, 31 Dec 2013 17:10:10 +0000 (UTC) Received: (qmail 55673 invoked by uid 500); 31 Dec 2013 17:10:04 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 55639 invoked by uid 500); 31 Dec 2013 17:10:01 -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 55576 invoked by uid 99); 31 Dec 2013 17:09:55 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Dec 2013 17:09:55 +0000 Date: Tue, 31 Dec 2013 17:09:55 +0000 (UTC) From: "JamesLi (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-5671) Fix socket leak in DFSInputStream#getBlockReader 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-5671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13859578#comment-13859578 ] JamesLi commented on HDFS-5671: ------------------------------- Thanks stack and Uma for the review and give me very helpful advices, I fell very happy to see this patch integrated in Hadoop trunk at the beginning of 2014,it's the best new year gift for me.Thank you all. > Fix socket leak in DFSInputStream#getBlockReader > ------------------------------------------------ > > Key: HDFS-5671 > URL: https://issues.apache.org/jira/browse/HDFS-5671 > Project: Hadoop HDFS > Issue Type: Bug > Components: hdfs-client > Affects Versions: 2.2.0 > Environment: hadoop-2.2.0 > java version "1.6.0_31" > Java(TM) SE Runtime Environment (build 1.6.0_31-b04) > Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode) > Linux 2.6.32-358.14.1.el6.x86_64 #1 SMP Tue Jul 16 23:51:20 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux > Reporter: JamesLi > Assignee: JamesLi > Priority: Critical > Fix For: 3.0.0, 2.3.0 > > Attachments: 5671.patch, 5671v1.patch, 5671v2.patch, 5671v3.patch, 5671v4.patch, HDFS-5671.patch > > > lsof -i TCP:1004 | grep -c CLOSE_WAIT > 18235 > When client request a file's block to DataNode:1004. If request fail because "java.io.IOException: Got error for OP_READ_BLOCK,Block token is expired." Occurs and the TCP socket that regionserver using is not closed. > I think the problem above is in DatanodeInfo blockSeekTo(long target) of Class DFSInputStream > The connection client using is BlockReader: > blockReader = getBlockReader(targetAddr, chosenNode, src, blk, > accessToken, offsetIntoBlock, blk.getNumBytes() - offsetIntoBlock, > buffersize, verifyChecksum, dfsClient.clientName); > In DFSInputStream.blockSeekTo()-line 533,invoke getBlockReader() which wil generate a peer use newTcpPeer(dnAddr) -line 1107,when BlockReaderFactory.newBlockReader throw IOException,the peer will not be closed which will cause a CLOSE_WAIT connection. > In our test,when datanode get a InvalidToken exception in DataXceiver.checkAccess(),it will close the connection.At regionserver side, in RemoteBlockReader2.newBlockReader(),checkSuccess() will throw a InvalidBlockTokenException, DFSInputStream.blockSeekTo() will catch the exception, but the connection is NOT closed, it become CLOSE_WAIT. -- This message was sent by Atlassian JIRA (v6.1.5#6160)