Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-11526

Memory leak in Bzip2Compressor and Bzip2Decompressor

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.0
    • Fix Version/s: 2.7.0
    • Component/s: io, native
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      The use of JNI's GetStringUTFChars should be paired with ReleaseStringUTFChars or else the utf-8 char* created by Java's JNI implementation is leaked. It isn't in Bzip2Decompressor.c:

      https://apache.googlesource.com/hadoop-common/+/refs/heads/trunk/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/bzip2/Bzip2Decompressor.c#45

      A less error-prone way of handling JNI resources like local references and UTF strings is to use a smart pointer like the Apache licensed code in Android's ScopedLocalRef and ScopedUtfChars:

      https://android.googlesource.com/platform/libnativehelper/+/jb-mr1.1-dev-plus-aosp/include/nativehelper/ScopedLocalRef.h
      https://android.googlesource.com/platform/libnativehelper/+/jb-mr1.1-dev-plus-aosp/include/nativehelper/ScopedUtfChars.h

        Attachments

        1. HADOOP-11526.002.patch
          5 kB
          Anu Engineer
        2. HADOOP-11526.001.patch
          2 kB
          Anu Engineer

          Activity

            People

            • Assignee:
              aengineer Anu Engineer
              Reporter:
              irogers Ian Rogers
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: