Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-1927

Scanners not closed properly in certain circumstances (memory leak)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.20.1
    • 0.20.2, 0.90.0
    • regionserver
    • None
    • Reviewed

    Description

      Scanners are sometimes leaked by the KeyValueHeap class. The constructor adds each scanner to a heap, but only if the scanner's peek() method returns not null (line 58). Otherwise the scanner is dropped without being closed.

      Unfortunately some scanners (like StoreScanner and MemStoreScanner) register themselves to some global list when constructed and only deregister on close(). This can cause a memory leak, for example with MemStoreScanners on an empty memory store.

      The quick fix is to add an else clause to the if on line 58:

      } else {
      scanner.close()
      }

      The root cause is that ownership of the scanners is transferred from the caller to the KeyValueHeap on construction. Maybe this should be made clear in the documentation or changed.

      Attachments

        1. HBASE-1927-v1.patch
          3 kB
          Jonathan Gray
        2. HBASE-1927-v1-trunk.patch
          3 kB
          Jonathan Gray

        Activity

          People

            streamy Jonathan Gray
            dlrozendaal Erik Rozendaal
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: