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

*Compressor_deflateBytesDirect passes instance instead of jclass to GetStaticObjectField

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: native
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/zlib/ZlibCompressor.c?view=markup

      This pattern appears in all the native compressors.
      // Get members of ZlibCompressor
      jobject clazz = (*env)->GetStaticObjectField(env, this,
      ZlibCompressor_clazz);

      The 2nd argument to GetStaticObjectField is supposed to be a jclass, not a jobject. Adding the JVM param -Xcheck:jni will cause "FATAL ERROR in native method: JNI received a class argument that is not a class" and a core dump such as the following.

      (gdb)
      #0 0x00007f02e4aef8a5 in raise () from /lib64/libc.so.6
      #1 0x00007f02e4af1085 in abort () from /lib64/libc.so.6
      #2 0x00007f02e45bd727 in os::abort(bool) () from /opt/jdk1.6.0_31/jre/lib/amd64/server/libjvm.so
      #3 0x00007f02e43cec63 in jniCheck::validate_class(JavaThread*, _jclass*, bool) () from /opt/jdk1.6.0_31/jre/lib/amd64/server/libjvm.so
      #4 0x00007f02e43ea669 in checked_jni_GetStaticObjectField () from /opt/jdk1.6.0_31/jre/lib/amd64/server/libjvm.so
      #5 0x00007f02d38eaf79 in Java_org_apache_hadoop_io_compress_zlib_ZlibCompressor_deflateBytesDirect () from /usr/lib/hadoop/lib/native/libhadoop.so.1.0.0

      In addition, that clazz object is only used for synchronization. In the case of the native method _deflateBytesDirect, the result is a class wide lock used to access the instance field uncompressed_direct_buf. Perhaps using the instance as the sync point is more appropriate?

        Attachments

        1. HADOOP-10027.1.patch
          2 kB
          Hui Zheng
        2. HADOOP-10027.2.patch
          7 kB
          Hui Zheng
        3. HADOOP-10027.3.patch
          34 kB
          Hui Zheng
        4. HADOOP-10027.4.patch
          35 kB
          Hui Zheng
        5. HADOOP-10027.5.patch
          37 kB
          Hui Zheng

          Issue Links

            Activity

              People

              • Assignee:
                huizane Hui Zheng
                Reporter:
                spackler Eric Abbott
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: