You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "易剑 (JIRA)" <ji...@apache.org> on 2016/11/28 06:41:58 UTC

[jira] [Commented] (HBASE-17182) Memory leak from openScanner of HBase thrift2

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

易剑 commented on HBASE-17182:
----------------------------

Client maybe not call closeScanner.
  
public int openScanner(ByteBuffer table, TScan scan) throws TIOError, TException {
    Table htable = getTable(table);
    ResultScanner resultScanner = null;
    try {
      resultScanner = htable.getScanner(scanFromThrift(scan));
    } catch (IOException e) {
      throw getTIOError(e);
    } finally {
      closeTable(htable);
    }
    return addScanner(resultScanner);
  }

  private int addScanner(ResultScanner scanner) {
    int id = nextScannerId.getAndIncrement();
    scannerMap.put(id, scanner);
    return id;
  }

  public void closeScanner(int scannerId) throws TIOError, TIllegalArgument, TException {
    LOG.debug("scannerClose: id=" + scannerId);
    ResultScanner scanner = getScanner(scannerId);
    if (scanner == null) {
      String message = "scanner ID is invalid";
      LOG.warn(message);
      TIllegalArgument ex = new TIllegalArgument();
      ex.setMessage("Invalid scanner Id");
      throw ex;
    }
    scanner.close();
    removeScanner(scannerId);
  }

> Memory leak from openScanner of HBase thrift2
> ---------------------------------------------
>
>                 Key: HBASE-17182
>                 URL: https://issues.apache.org/jira/browse/HBASE-17182
>             Project: HBase
>          Issue Type: Bug
>          Components: Thrift
>            Reporter: 易剑
>
> Client call openScanner, but client (coredump or others) not closeScanner, the scanner will not be removed from scannerMap.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)