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

Nemon Lou commented on HIVE-9839:
---------------------------------

The piece of code in org.apache.hive.service.cli.session.HiveSessionImpl.java 
that causing this issue:
{code}
        private OperationHandle executeStatementInternal(String statement, 
Map<String, String> confOverlay,
370           boolean runAsync)
371               throws HiveSQLException {
372         acquire(true);
373     
374         OperationManager operationManager = getOperationManager();
375         ExecuteStatementOperation operation = operationManager
376             .newExecuteStatementOperation(getSession(), statement, 
confOverlay, runAsync);
377         OperationHandle opHandle = operation.getHandle();
378         try {
379           operation.run();
380           opHandleSet.add(opHandle);
381           return opHandle;
382         } catch (HiveSQLException e) {
383           // Cleanup opHandle in case the query is synchronous
384           // Async query needs to retain and pass back the opHandle for 
error reporting
385           if (!runAsync) {
386             operationManager.closeOperation(opHandle);
387           }
388           throw e;
389         } finally {
390           release(true);
391         }
392       }
{code}
When a HiveSQLException throw from line 379,the opHandle is not closed due to 
async mode and is not been put into opHandleSet for future clean up.
Async query is the default query mode in hiveserver2 clients.

> HiveServer2 leaks OperationHandle on failed async queries
> ---------------------------------------------------------
>
>                 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
>            Reporter: Nemon Lou
>
> 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