Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 728B9200CA8 for ; Thu, 15 Jun 2017 16:37:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 711C6160BDF; Thu, 15 Jun 2017 14:37:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B77F2160BC4 for ; Thu, 15 Jun 2017 16:37:06 +0200 (CEST) Received: (qmail 62946 invoked by uid 500); 15 Jun 2017 14:37:05 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 62935 invoked by uid 99); 15 Jun 2017 14:37:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jun 2017 14:37:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 7DFB8C6602 for ; Thu, 15 Jun 2017 14:37:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.211 X-Spam-Level: X-Spam-Status: No, score=-99.211 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id nHZioVRWFEAP for ; Thu, 15 Jun 2017 14:37:04 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 80E265F6BF for ; Thu, 15 Jun 2017 14:37:04 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 7D5F7E07D3 for ; Thu, 15 Jun 2017 14:37:03 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 7056C21D8F for ; Thu, 15 Jun 2017 14:37:01 +0000 (UTC) Date: Thu, 15 Jun 2017 14:37:01 +0000 (UTC) From: "Pavel Avgustinov (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-11976) Examine code base for cases that exception is thrown from finally block and fix it MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 15 Jun 2017 14:37:07 -0000 [ https://issues.apache.org/jira/browse/HDFS-11976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16050561#comment-16050561 ] Pavel Avgustinov commented on HDFS-11976: ----------------------------------------- This concern is easy to capture with the query language used by [lgtm|https://lgtm.com]. I've just written a query for it, which you can see [here|https://lgtm.com/query/1995330256/project:5629499534213120/lang:java/] -- it finds 32 results in the [GitHub mirror of Hadoop|https://github.com/apache/hadoop], including a number within HDFS itself. (Disclaimer: I'm a co-founder of Semmle, the company that provides lgtm as a free service to open source.) > Examine code base for cases that exception is thrown from finally block and fix it > ---------------------------------------------------------------------------------- > > Key: HDFS-11976 > URL: https://issues.apache.org/jira/browse/HDFS-11976 > Project: Hadoop HDFS > Issue Type: Bug > Reporter: Yongjun Zhang > > If exception X is thrown in try block, and exception Y is thrown is finally block, X will be swallowed. > In addition, finally block is used to ensure resources are released properly in general. If we throw exception from there, some resources may be leaked. So it's not recommended to throw exception in the finally block > I caught one today and reported HDFS-11794, creating this jira as a master one to catch other similar cases. > Hope there is some static analyzer to find all. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org