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 5838F200C79 for ; Thu, 4 May 2017 11:15:11 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 56C2B160B9F; Thu, 4 May 2017 09:15:11 +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 A09FB160BB0 for ; Thu, 4 May 2017 11:15:10 +0200 (CEST) Received: (qmail 87374 invoked by uid 500); 4 May 2017 09:15:09 -0000 Mailing-List: contact issues-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list issues@hive.apache.org Received: (qmail 87103 invoked by uid 99); 4 May 2017 09:15:08 -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; Thu, 04 May 2017 09:15:08 +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 92F311883D6 for ; Thu, 4 May 2017 09:15:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-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 WGrStcZU28kb for ; Thu, 4 May 2017 09:15:07 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 748585FAE8 for ; Thu, 4 May 2017 09:15:06 +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 914ABE0D2A for ; Thu, 4 May 2017 09:15:05 +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 B05FE21DF1 for ; Thu, 4 May 2017 09:15:04 +0000 (UTC) Date: Thu, 4 May 2017 09:15:04 +0000 (UTC) From: "Peter Vary (JIRA)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HIVE-16451) Race condition between HiveStatement.getQueryLog and HiveStatement.runAsyncOnServer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 04 May 2017 09:15:11 -0000 [ https://issues.apache.org/jira/browse/HIVE-16451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15996405#comment-15996405 ] Peter Vary commented on HIVE-16451: ----------------------------------- [~anishek]: Could you please take a look at it, if you have time? Thanks, Peter > Race condition between HiveStatement.getQueryLog and HiveStatement.runAsyncOnServer > ----------------------------------------------------------------------------------- > > Key: HIVE-16451 > URL: https://issues.apache.org/jira/browse/HIVE-16451 > Project: Hive > Issue Type: Bug > Components: Beeline, JDBC > Affects Versions: 3.0.0 > Reporter: Peter Vary > Assignee: Peter Vary > Attachments: HIVE-16451.02.patch, HIVE-16451.03.patch, HIVE-16451.patch > > > During the BeeLineDriver testing I have met the following race condition: > - Run the query asynchronously through BeeLine > - Querying the logs in the BeeLine > In the following code: > {code:title=HiveStatement.runAsyncOnServer} > private void runAsyncOnServer(String sql) throws SQLException { > checkConnection("execute"); > closeClientOperation(); > initFlags(); > [..] > } > {code} > {code:title=HiveStatement.getQueryLog} > public List getQueryLog(boolean incremental, int fetchSize) > throws SQLException, ClosedOrCancelledStatementException { > [..] > try { > if (stmtHandle != null) { > [..] > } else { > if (isQueryClosed) { > throw new ClosedOrCancelledStatementException("Method getQueryLog() failed. The " + > "statement has been closed or cancelled."); > } else { > return logs; > } > } > } catch (SQLException e) { > [..] > } > [..] > } > {code} > The runAsyncOnServer {{closeClientOperation}} sets {{isQueryClosed}} flag to true: > {code:title=HiveStatement.closeClientOperation} > void closeClientOperation() throws SQLException { > [..] > isQueryClosed = true; > isExecuteStatementFailed = false; > stmtHandle = null; > } > {code} > The {{initFlags}} sets it to false: > {code} > private void initFlags() { > isCancelled = false; > isQueryClosed = false; > isLogBeingGenerated = true; > isExecuteStatementFailed = false; > isOperationComplete = false; > } > {code} > If the {{getQueryLog}} is called after the {{closeClientOperation}}, but before the {{initFlags}}, then we will have a following warning if verbose mode is set to true in BeeLine: > {code} > Warning: org.apache.hive.jdbc.ClosedOrCancelledStatementException: Method getQueryLog() failed. The statement has been closed or cancelled. (state=,code=0) > {code} > This caused this fail: > https://builds.apache.org/job/PreCommit-HIVE-Build/4691/testReport/org.apache.hadoop.hive.cli/TestBeeLineDriver/testCliDriver_smb_mapjoin_11_/ > {code} > Error Message > Client result comparison failed with error code = 1 while executing fname=smb_mapjoin_11 > 16a17 > > Warning: org.apache.hive.jdbc.ClosedOrCancelledStatementException: Method getQueryLog() failed. The statement has been closed or cancelled. (state=,code=0) > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)