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

kirby zhou commented on HIVE-24694:
-----------------------------------

If you do not check transport.isOpen (), call transport.close () directly when 
transport is not null, will there be any disadvantages?

 
{code:java}

  public void close() throws SQLException {
    if (!isClosed) {
      TCloseSessionReq closeReq = new TCloseSessionReq(sessHandle);
      try {
        client.CloseSession(closeReq);
        if (!isClosed) {
          TCloseSessionReq closeReq = new TCloseSessionReq(sessHandle);
          client.CloseSession(closeReq);
        }
      } catch (TException e) {
        throw new SQLException("Error while cleaning up the server resources", 
e);
      } finally {
        isClosed = true;
        if (transport != null) {
        client = null;
        if (transport != null && transport.isOpen()) {
          transport.close();
          transport = null;
        } {code}

> Early connection close to release server resources during creating
> ------------------------------------------------------------------
>
>                 Key: HIVE-24694
>                 URL: https://issues.apache.org/jira/browse/HIVE-24694
>             Project: Hive
>          Issue Type: Bug
>          Components: HiveServer2
>            Reporter: Zhihua Deng
>            Assignee: Zhihua Deng
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.0.0-alpha-1
>
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> If exception happens during we try to get the connection from HiveDriver,  
> the opened transport or session may leave unclosed as the connection returned 
> is null, we cannot call the close method to release the server 
> resources(threads, connection quota, etc.), this could make things more worse 
> if the user rearches the connection limit and retries... 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to