[ 
https://issues.apache.org/jira/browse/HIVE-9839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14369472#comment-14369472
 ] 

Yongzhi Chen commented on HIVE-9839:
------------------------------------

Hi, any progress in this issue? Thanks.
If OperationHandle has to be returned to report the error in Async mode, maybe 
we can do following, then client can close it; If not, [~jxiang]'s patch should 
be fine.

{code}

  private OperationHandle executeStatementInternal(String statement, 
Map<String, String> confOverlay,
      boolean runAsync)
          throws HiveSQLException {
    acquire(true);

    OperationManager operationManager = getOperationManager();
    ExecuteStatementOperation operation = operationManager
        .newExecuteStatementOperation(getSession(), statement, confOverlay, 
runAsync);
    OperationHandle opHandle = operation.getHandle();
    try {
      operation.run();
      opHandleSet.add(opHandle);
      return opHandle;
    } catch (HiveSQLException e) {
      // Cleanup opHandle in case the query is synchronous
      // Async query needs to retain and pass back the opHandle for error 
reporting
      if (!runAsync) {
        operationManager.closeOperation(opHandle);
        throw e;
      }
      else {
        opHandleSet.add(opHandle);
        return opHandle;
      }
      
    } finally {
      release(true);
    }
  }
{code}

> HiveServer2 leaks OperationHandle on async queries which fail at compile phase
> ------------------------------------------------------------------------------
>
>                 Key: HIVE-9839
>                 URL: https://issues.apache.org/jira/browse/HIVE-9839
>             Project: Hive
>          Issue Type: Bug
>          Components: HiveServer2
>    Affects Versions: 0.14.0, 0.13.1, 1.0.0, 1.1.0
>            Reporter: Nemon Lou
>            Priority: Critical
>         Attachments: OperationHandleMonitor.java, hive-9839.patch
>
>
> Using beeline to connect to HiveServer2.And type the following:
> drop table if exists table_not_exists;
> select * from table_not_exists;
> There will be an OperationHandle object staying in HiveServer2's memory for 
> ever even after quit from beeline .



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to