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

ASF GitHub Bot logged work on HIVE-24694:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/Jan/21 13:58
            Start Date: 29/Jan/21 13:58
    Worklog Time Spent: 10m 
      Work Description: dengzhhu653 commented on a change in pull request #1920:
URL: https://github.com/apache/hive/pull/1920#discussion_r566839416



##########
File path: jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
##########
@@ -1104,18 +1102,18 @@ public void clearWarnings() throws SQLException {
 
   @Override
   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) {
+        if (transport != null && transport.isOpen()) {
           transport.close();
         }

Review comment:
       done and add some pre-checks on the connection state to avoid potential 
NPE




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 544278)
    Time Spent: 1h  (was: 50m)

> 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
>          Time Spent: 1h
>  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.3.4#803005)

Reply via email to