You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Colin Patrick McCabe (JIRA)" <ji...@apache.org> on 2016/03/25 23:57:25 UTC

[jira] [Commented] (HADOOP-12955) Fix bugs in the initialization of the ISA-L library JNI bindings

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

Colin Patrick McCabe commented on HADOOP-12955:
-----------------------------------------------

Thanks for the revisions.  It is good to see checking for names which are too long, as well as fixes to the other little bugs.

If the error string being returned is a constant string, it should be a {{const char*}} rather than a {{char*}}.  Also, please document that the string does not need to be freed by the caller in the doxygen.

bq. I thought loadLib handles its error itself by throwing an exception.

C does not have exceptions.  When the C code calls a Java method via JNI, the C code must check for an error condition and return if that occurs.  if the C caller does not check, execution will continue.  The results of calling many JNI methods when an exception is raised are undefined.  I believe the situation is similar when calling Java code through C++, even though that language does have exceptions.  The important thing to keep in mind is that Java exceptions do not translate into the JNI code.

Can you fix the cases where we are not checking for java exceptions?

> Fix bugs in the initialization of the ISA-L library JNI bindings
> ----------------------------------------------------------------
>
>                 Key: HADOOP-12955
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12955
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: native
>            Reporter: Kai Zheng
>            Assignee: Kai Zheng
>         Attachments: HADOOP-12955-v1.patch, HADOOP-12955-v2.patch
>
>
> Ref. the comment [here|https://issues.apache.org/jira/browse/HADOOP-11540?focusedCommentId=15207619&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15207619]. 
> When run hadoop checknative, it also failed. Got something like below from log:
> {noformat}
> Stack: [0x00007f2b9d405000,0x00007f2b9d506000],  sp=0x00007f2b9d504748,  free space=1021k
> Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
> V  [libjvm.so+0xa90c90]  UTF8::unicode_length(char const*)+0x0
> V  [libjvm.so+0x6ddfc3]  jni_NewStringUTF+0xc3
> j  org.apache.hadoop.io.erasurecode.ErasureCodeNative.getLibraryName()Ljava/lang/String;+0
> j  org.apache.hadoop.util.NativeLibraryChecker.main([Ljava/lang/String;)V+212
> v  ~StubRoutines::call_stub
> V  [libjvm.so+0x68c616]  JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*)+0x1056
> V  [libjvm.so+0x6cdc32]  jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*)+0x362
> V  [libjvm.so+0x6ea63a]  jni_CallStaticVoidMethod+0x17a
> C  [libjli.so+0x7bcc]  JavaMain+0x80c
> C  [libpthread.so.0+0x8182]  start_thread+0xc2
> Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
> j  org.apache.hadoop.io.erasurecode.ErasureCodeNative.getLibraryName()Ljava/lang/String;+0
> j  org.apache.hadoop.util.NativeLibraryChecker.main([Ljava/lang/String;)V+212
> v  ~StubRoutines::call_stub
> {noformat}



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