Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-16180

LLAP: Native memory leak in EncodedReader

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.2.0
    • 2.3.0
    • llap
    • None

    Description

      Observed this in internal test run. There is a native memory leak in Orc EncodedReaderImpl that can cause YARN pmem monitor to kill the container running the daemon. Direct byte buffers are null'ed out which is not guaranteed to be cleaned until next Full GC. To show this issue, attaching a small test program that allocates 3x256MB direct byte buffers. First buffer is null'ed out but still native memory is used. Second buffer user Cleaner to clean up native allocation. Third buffer is also null'ed but this time invoking a System.gc() which cleans up all native memory. Output from the test program is below

      Allocating 3x256MB direct memory..
      Native memory used: 786432000
      Native memory used after data1=null: 786432000
      Native memory used after data2.clean(): 524288000
      Native memory used after data3=null: 524288000
      Native memory used without gc: 524288000
      Native memory used after gc: 0
      

      Longer term improvements/solutions:
      1) Use DirectBufferPool from hadoop or netty's https://netty.io/4.0/api/io/netty/buffer/PooledByteBufAllocator.html as direct byte buffer allocations are expensive (System.gc() + 100ms thread sleep).
      2) Use HADOOP-12760 for proper cleaner invocation in JDK8 and JDK9

      Attachments

        1. HIVE-16180.1.patch
          3 kB
          Prasanth Jayachandran
        2. DirectCleaner.java
          2 kB
          Prasanth Jayachandran
        3. Full-gc-native-mem-cleanup.png
          130 kB
          Prasanth Jayachandran
        4. FullGC-15GB-cleanup.png
          129 kB
          Prasanth Jayachandran
        5. Native-mem-spike.png
          41 kB
          Prasanth Jayachandran
        6. HIVE-16180.2.patch
          8 kB
          Prasanth Jayachandran
        7. HIVE-16180.03.patch
          21 kB
          Sergey Shelukhin
        8. HIVE-16180.04.patch
          22 kB
          Sergey Shelukhin

        Activity

          People

            sershe Sergey Shelukhin
            prasanth_j Prasanth Jayachandran
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: