Return-Path: X-Original-To: apmail-hawq-commits-archive@minotaur.apache.org Delivered-To: apmail-hawq-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3BB7A19AF5 for ; Wed, 13 Apr 2016 01:36:50 +0000 (UTC) Received: (qmail 6164 invoked by uid 500); 13 Apr 2016 01:36:49 -0000 Delivered-To: apmail-hawq-commits-archive@hawq.apache.org Received: (qmail 6127 invoked by uid 500); 13 Apr 2016 01:36:49 -0000 Mailing-List: contact commits-help@hawq.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hawq.incubator.apache.org Delivered-To: mailing list commits@hawq.incubator.apache.org Received: (qmail 6118 invoked by uid 99); 13 Apr 2016 01:36:49 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Apr 2016 01:36:49 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 6B8B8180534 for ; Wed, 13 Apr 2016 01:36:49 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.221 X-Spam-Level: X-Spam-Status: No, score=-3.221 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Ks2QWKAc6HtF for ; Wed, 13 Apr 2016 01:36:47 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with SMTP id 3F5365F20E for ; Wed, 13 Apr 2016 01:36:46 +0000 (UTC) Received: (qmail 6114 invoked by uid 99); 13 Apr 2016 01:36:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Apr 2016 01:36:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 30D47DFB95; Wed, 13 Apr 2016 01:36:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yjin@apache.org To: commits@hawq.incubator.apache.org Message-Id: <527d29604ebe47d5a06791e19899db17@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-hawq git commit: HAWQ-664. The return value of registering fd is not checked for asynchronous connection Date: Wed, 13 Apr 2016 01:36:45 +0000 (UTC) Repository: incubator-hawq Updated Branches: refs/heads/master 5553271a6 -> 17389e39a HAWQ-664. The return value of registering fd is not checked for asynchronous connection Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/17389e39 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/17389e39 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/17389e39 Branch: refs/heads/master Commit: 17389e39a6d5cc1f40b18694779d5228dc749de8 Parents: 5553271 Author: YI JIN Authored: Wed Apr 13 11:36:22 2016 +1000 Committer: YI JIN Committed: Wed Apr 13 11:36:22 2016 +1000 ---------------------------------------------------------------------- .../communication/rmcomm_AsyncComm.c | 74 +++++++++++--------- 1 file changed, 41 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/17389e39/src/backend/resourcemanager/communication/rmcomm_AsyncComm.c ---------------------------------------------------------------------- diff --git a/src/backend/resourcemanager/communication/rmcomm_AsyncComm.c b/src/backend/resourcemanager/communication/rmcomm_AsyncComm.c index ee005bf..f2203db 100644 --- a/src/backend/resourcemanager/communication/rmcomm_AsyncComm.c +++ b/src/backend/resourcemanager/communication/rmcomm_AsyncComm.c @@ -691,7 +691,7 @@ int registerAsyncConnectionFileDesc(const char *address, methods, userdata, newcommbuffer); - goto exit; + return res; } /* Create socket FD */ @@ -725,27 +725,30 @@ int registerAsyncConnectionFileDesc(const char *address, if ( setConnectionLongTermNoDelay(fd) != FUNC_RETURN_OK ) { close(fd); - res = UTIL_NETWORK_FAIL_CONNECT; - goto exit; + return UTIL_NETWORK_FAIL_CONNECT; } /* * New connection is created. Suppose domain socket and local socket * connection can be done now. Register a normal client FD in poll() to * perform content sending and receiving. */ - res = registerFileDesc(fd, - actionmask, - methods, - userdata, - newcommbuffer); - - /* Assign connection address. */ - assignFileDescClientAddressInfo(*newcommbuffer, - address, - port, - &server_addr, - sizeof(server_addr)); - goto exit; + res = registerFileDesc(fd, actionmask, methods, userdata, newcommbuffer); + if ( res == FUNC_RETURN_OK ) + { + /* Assign connection address. */ + assignFileDescClientAddressInfo(*newcommbuffer, + address, + port, + &server_addr, + sizeof(server_addr)); + } + else + { + write_log("registerAsyncCommectionFileDesc failed registering fd %d.", + fd); + close(fd); + res = UTIL_NETWORK_FAIL_CONNECT; + } } else if ( sockres < 0 && errno == EINPROGRESS ) { @@ -758,27 +761,32 @@ int registerAsyncConnectionFileDesc(const char *address, methods, userdata, newcommbuffer); - - /* Assign connection address. */ - assignFileDescClientAddressInfo(*newcommbuffer, - address, - port, - &server_addr, - sizeof(server_addr)); - - goto exit; + if ( res == FUNC_RETURN_OK ) + { + /* Assign connection address. */ + assignFileDescClientAddressInfo(*newcommbuffer, + address, + port, + &server_addr, + sizeof(server_addr)); + } + else + { + write_log("registerAsyncCommectionFileDesc failed registering fd %d.", + fd); + close(fd); + res = UTIL_NETWORK_FAIL_CONNECT; + } } else { /* Fail to build connection. */ - write_log("registerAsyncConnectionFileDesc connect socket failed, " - "fd %d (errno %d)", - fd, - errno); - close(fd); - res = UTIL_NETWORK_FAIL_CONNECT; + write_log("registerAsyncConnectionFileDesc connect socket failed, " + "fd %d (errno %d)", + fd, + errno); + close(fd); + res = UTIL_NETWORK_FAIL_CONNECT; } - -exit: return res; }