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

Xuefu Zhang commented on HIVE-17401:
------------------------------------

{code}  
private void startTimeoutChecker() {
  ...
    final Runnable timeoutChecker = new Runnable() {
      @Override
      public void run() {
        sleepFor(interval);
        while (!shutdown) {
          ...
            if (sessionTimeout > 0 && session.getLastAccessTime() + 
sessionTimeout <= current
                && (!checkOperation || session.getNoOperationTime() > 
sessionTimeout)) {
              ...
            } else {
              session.closeExpiredOperations();
            }
          }
          sleepFor(interval);
        }
      }
{code}
In the condition {{session.getNoOperationTime() > sessionTimeout}} is not true, 
execution will go to else clause. However, 
{{session.closeExpiredOperations();}} will eventually call 
HiveSessionImpl.acquire(), which will set {{lastIdleTime = 0}}. This will make 
the condition {{session.getNoOperationTime() > sessionTimeout}} never true, 
causing a session leak.

> Hive session idle timeout doesn't function properly
> ---------------------------------------------------
>
>                 Key: HIVE-17401
>                 URL: https://issues.apache.org/jira/browse/HIVE-17401
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>            Reporter: Xuefu Zhang
>            Assignee: Xuefu Zhang
>
> It's apparent in our production environment that HS2 leaks sessions, which at 
> least contributed to memory leaks in HS2. We further found that idle HS2 
> sessions rarely get timed out and the number of live session keeps increasing 
> as time goes on. Eventually, HS2 becomes irresponsive and demands a restart.
> Investigation shows that session idle timeout doesn't work appropriately.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to