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 59559200CAD for ; Wed, 14 Jun 2017 01:17:34 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 57DD1160BE9; Tue, 13 Jun 2017 23:17:34 +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 A327F160BEB for ; Wed, 14 Jun 2017 01:17:33 +0200 (CEST) Received: (qmail 34576 invoked by uid 500); 13 Jun 2017 23:17:32 -0000 Mailing-List: contact commits-help@impala.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@impala.incubator.apache.org Delivered-To: mailing list commits@impala.incubator.apache.org Received: (qmail 34567 invoked by uid 99); 13 Jun 2017 23:17:32 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Jun 2017 23:17:32 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 51836C05CB for ; Tue, 13 Jun 2017 23:17:32 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.222 X-Spam-Level: X-Spam-Status: No, score=-4.222 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id Dm7_anljkH-8 for ; Tue, 13 Jun 2017 23:17:31 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 072325FBEA for ; Tue, 13 Jun 2017 23:17:29 +0000 (UTC) Received: (qmail 34454 invoked by uid 99); 13 Jun 2017 23:17:29 -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; Tue, 13 Jun 2017 23:17:29 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5D2A7E0EE6; Tue, 13 Jun 2017 23:17:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tarmstrong@apache.org To: commits@impala.incubator.apache.org Date: Tue, 13 Jun 2017 23:17:31 -0000 Message-Id: <9f2bd6e5310443c99c86c560660e1319@git.apache.org> In-Reply-To: <00b2b832330742d19af7fa69217b57af@git.apache.org> References: <00b2b832330742d19af7fa69217b57af@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/7] incubator-impala git commit: IMPALA-5487: Fix race in RuntimeProfile::toThrift() archived-at: Tue, 13 Jun 2017 23:17:34 -0000 IMPALA-5487: Fix race in RuntimeProfile::toThrift() node.num_children got initialized before children_ was locked. This could lead to node.num_children < children_.size(), which made the node tree in the resulting thrift profiles not deserialize properly. To fix this, node.num_children needs to be initialized after children_ has been locked. I tested this by running queries on a private cluster for a while, making sure that the thrift profiles of running queries could be parsed correctly. Change-Id: I7fad4ee2eee1f73e387c1e90a3db265b19b3a0c6 Reviewed-on: http://gerrit.cloudera.org:8080/7154 Reviewed-by: Dan Hecht Reviewed-by: Tim Armstrong Reviewed-by: Sailesh Mukil Tested-by: Impala Public Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/58baca74 Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/58baca74 Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/58baca74 Branch: refs/heads/master Commit: 58baca7455fb5ff153455fe7b53292ab5e431371 Parents: 9fd46f7 Author: Lars Volker Authored: Sun Jun 11 22:01:34 2017 -0700 Committer: Impala Public Jenkins Committed: Tue Jun 13 00:34:21 2017 +0000 ---------------------------------------------------------------------- be/src/util/runtime-profile.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/58baca74/be/src/util/runtime-profile.cc ---------------------------------------------------------------------- diff --git a/be/src/util/runtime-profile.cc b/be/src/util/runtime-profile.cc index 9efe556..5ff9d28 100644 --- a/be/src/util/runtime-profile.cc +++ b/be/src/util/runtime-profile.cc @@ -761,13 +761,10 @@ void RuntimeProfile::ToThrift(TRuntimeProfileTree* tree) const { } void RuntimeProfile::ToThrift(vector* nodes) const { - nodes->reserve(nodes->size() + children_.size()); - int index = nodes->size(); nodes->push_back(TRuntimeProfileNode()); TRuntimeProfileNode& node = (*nodes)[index]; node.name = name_; - node.num_children = children_.size(); node.metadata = metadata_; node.indent = true; @@ -839,6 +836,7 @@ void RuntimeProfile::ToThrift(vector* nodes) const { { lock_guard l(children_lock_); children = children_; + node.num_children = children_.size(); } for (int i = 0; i < children.size(); ++i) { int child_idx = nodes->size();