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

Chinna Rao Lalam commented on HIVE-1908:
----------------------------------------

File handlers are leaking as the streams are not closed in Driver class (i.e 
fetchTask and resStream ).  
 
"Driver.compile()"  is internally calls "close()" if "plan != null".  
In Driver.close() clear the "fetchtask" in the plan and close the "resStream "

{code}

public int close() {
    try {
      if (plan != null) {
        FetchTask fetchTask = plan.getFetchTask();
        if (null != fetchTask) {
          try {
            fetchTask.clearFetch();
          } catch (Exception e) {
            LOG.debug(" Exception while clearing the Fetch task ", e);
          }
        }
      }
      if (ctx != null) {
        ctx.clear();
      }
      if (null != resStream) {
        try {
          ((FSDataInputStream) resStream).close();
        } catch (Exception e) {
          LOG.debug(" Exception while closing the  the res file stream ", e);
        }
      }
    } catch (Exception e) {
      console.printError("FAILED: Hive Internal Error: " + 
Utilities.getNameMessage(e) + "\n"
          + org.apache.hadoop.util.StringUtils.stringifyException(e));
      return 13;
    }

    return 0;
  }

{code}

> FileHandler leak on partial iteration of the resultset. 
> --------------------------------------------------------
>
>                 Key: HIVE-1908
>                 URL: https://issues.apache.org/jira/browse/HIVE-1908
>             Project: Hive
>          Issue Type: Bug
>          Components: Server Infrastructure
>    Affects Versions: 0.6.0
>         Environment: Hadoop 0.20.1, Hive0.6.0 and SUSE Linux Enterprise 
> Server 10 SP2 (i586) - Kernel 2.6.16.60-0.21-smp (5).
>            Reporter: Chinna Rao Lalam
>
> If the "resultset" is not iterated completely ,  one filehandler is leaking
> Ex: We need only first row. This case one resource is leaking
> {code}
> ResultSet resultSet = createStatement.executeQuery("select * from 
> sampletable");
> if (resultSet.next())
> {
>       System.out.println(resultSet.getString(1)+"   "+resultSet.getString(2));
> } 
> {code}
> Command used for checking the filehandlers
> {code}
> lsof -p {hive_process_id} > runjarlsof.txt
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to