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 8A1EF200C55 for ; Thu, 13 Apr 2017 21:59:17 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 88287160B98; Thu, 13 Apr 2017 19:59:17 +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 CD66A160B89 for ; Thu, 13 Apr 2017 21:59:16 +0200 (CEST) Received: (qmail 78524 invoked by uid 500); 13 Apr 2017 19:59:16 -0000 Mailing-List: contact dev-help@asterixdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.apache.org Delivered-To: mailing list dev@asterixdb.apache.org Received: (qmail 78507 invoked by uid 99); 13 Apr 2017 19:59:15 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Apr 2017 19:59:15 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 4945A1AFF4E for ; Thu, 13 Apr 2017 19:59:15 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.12 X-Spam-Level: X-Spam-Status: No, score=-0.12 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id BxKuA81oHdJ2 for ; Thu, 13 Apr 2017 19:59:13 +0000 (UTC) Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id B6CDB5F1C2 for ; Thu, 13 Apr 2017 19:59:12 +0000 (UTC) Received: by mail-wm0-f44.google.com with SMTP id w64so119431825wma.0 for ; Thu, 13 Apr 2017 12:59:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=iFU55OnwnGA2d0NbV0shBLYYC4Z1fbVOKzw93Mnku48=; b=FjdboXzCU+MNVWcBKyKOGqOR8g+hP+2sXQLiaALuZa3ldS3Z3ETStlnDAVIfmiNkWy z9kfEXp/MpcmrW8lB3PEet/V1HBNYPDJY9s49i/fldSt3Vx1Y9ukY4dIql7A7ELFd5/H HAWxs2Wa9dji2g9NcH0p1Y5pHuU4uaNPaotX9ip19Kstave4/SzqacUHsmxyhuIhSZon rLTsNCdoQh5bbKs204sowChUimiv3EHIycgyZUWqM5QhUq9sgC+yPF8XbT5lUS13sMrW lMKUp2bQh1jeNW5BeP+I0iBKHWVY8dMrZ5eR6310Z/Vk1AF225QLqbKEU7k8DmWAl2Qa 8rmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=iFU55OnwnGA2d0NbV0shBLYYC4Z1fbVOKzw93Mnku48=; b=q8vuCxL+dOd+DcMSTzMQxW/uIm46Xy53/C29EF1Css0U0nSZ24l8XvZeAuN1iI0J9j sxNtfZL/Wfbyy+he3dbxJSXrcfkp6PB3bapk3jT9CAs+jxdgAKLljrs1rNvoT2VQAG0D AfCVvTxjijsYD8pWaOkvJ+hAyUYx1l2o3FhjNvYVTrn98X+upSZBDHQC5p4+H28OqnF/ QcNJzuN2dekYsHtPCFHnjpVWqFkPLhrYxedhDQmH5g7oef84nvA5gskbuQuOGwggl2aD J5FZHAp7a/6E4IsgCR/C3fT5JaMt0td0VaI30Cltzo1Z9B238HLliIdBAdVe88CeEM1Q c8Zg== X-Gm-Message-State: AN3rC/6U2/OFU+SrcmACu3voflR0ITl29z835lqXNggF1YLUcdxLYSKX jemlT1gmyH9oSesPMVg= X-Received: by 10.28.4.142 with SMTP id 136mr18817213wme.89.1492113552201; Thu, 13 Apr 2017 12:59:12 -0700 (PDT) Received: from [192.168.1.17] ([188.51.117.22]) by smtp.gmail.com with ESMTPSA id m201sm74453wmd.15.2017.04.13.12.59.11 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Apr 2017 12:59:11 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Catch Exception instead of Throwable From: abdullah alamoudi In-Reply-To: Date: Thu, 13 Apr 2017 22:59:10 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <17C59906-0836-4B25-9A40-8A9DB71E06E1@gmail.com> References: To: dev@asterixdb.apache.org X-Mailer: Apple Mail (2.3124) archived-at: Thu, 13 Apr 2017 19:59:17 -0000 I have been switching positions too myself but now I think that catching = Throwable is fine in some cases. For example try{ writer.open() } catch(Throwable th){ writer.fail(); throw th; } finally{ writer.close(); } If we replace Throwable with Exception in this case, then we have a = small problem and that is writer.fail() will not be called in some = cases. One of the common uses of writer.fail() is to tell the writers in = the pipeline not to do any additional work in the close() call since the = pipeline has failed and additional work could produce further failures. So I think such uses is acceptable but other than using it to enforce = the contract, we should not catch Throwable. Another way to think about this is to say that Errors are always = terminal and that it is time to call the shutdown hook and that we don't = care if writer.fail() was not called in that case and we probably assume = that writer.close will encounter a few additional failures. If we choose = to follow that, then we should document this somewhere for reference and = then stick to it everywhere. Personally, I prefer to catch Throwable in restricted places but I am = okay with going route 2 as well. ~Abdullah. > On Apr 13, 2017, at 8:02 PM, Till Westmann wrote: >=20 > Hi, >=20 > I just looked at Abdullah=E2=80=99s change [1] which adds more = consistency around > the behavior of our operators in error cases. In the change there are = a > number of SQ complaints about catching Throwable [2] and as I always > wondered what the right approach on this is (changing my mind a few = times), > I=E2=80=99d like to discuss this here and capture the result to apply = the outcome > consistently across the system. >=20 > Please reply to this with your thoughts on catching Throwable vs not > catching Error. >=20 > Thanks, > Till >=20 > [1] https://asterix-gerrit.ics.uci.edu/#/c/1618 > [2] = https://asterix-sonar.ics.uci.edu/coding_rules#rule_key=3Dsquid%3AS1181