HI all :
     I write a new block driver based on hdfs of hadoop, it need to
connect to hdfs when create step (called by bdrv_create in block.c) by
use libhdfs ( hdfs c++ api) 。
     libhdfs use jni api to will create jvm . The problem is  —— it
will cause sigsegv error when create jvm .

#0  0x00007ffff64b103a in frame::frame(long*, long*) () from
/usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#1  0x00007ffff6685aef in
java_lang_Throwable::fill_in_stack_trace(Handle, Thread*) () from
/usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#2  0x00007ffff6685b99 in
java_lang_Throwable::fill_in_stack_trace(Handle) () from
/usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#3  0x00007ffff65d5db7 in
Exceptions::throw_stack_overflow_exception(Thread*, char const*, int)
() from /usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#4  0x00007ffff667f501 in JavaCalls::call_helper(JavaValue*,
methodHandle*, JavaCallArguments*, Thread*) () from
/usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#5  0x00007ffff68af629 in os::os_exception_wrapper(void
(*)(JavaValue*, methodHandle*, JavaCallArguments*, Thread*),
JavaValue*, methodHandle*, JavaCallArguments*, Thread*) () from
/usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#6  0x00007ffff667f3d5 in JavaCalls::call(JavaValue*, methodHandle,
JavaCallArguments*, Thread*) () from
/usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#7  0x00007ffff664efd5 in
instanceKlass::call_class_initializer_impl(instanceKlassHandle,
Thread*) () from
/usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#8  0x00007ffff664d558 in
instanceKlass::initialize_impl(instanceKlassHandle, Thread*) () from
/usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#9  0x00007ffff664c91a in instanceKlass::initialize(Thread*) () from
/usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#10 0x00007ffff664d81c in
instanceKlass::initialize_impl(instanceKlassHandle, Thread*) () from
/usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#11 0x00007ffff664c91a in instanceKlass::initialize(Thread*) () from
/usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#12 0x00007ffff69bdd04 in Threads::create_vm(JavaVMInitArgs*, bool*)
() from /usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#13 0x00007ffff66ba7b0 in JNI_CreateJavaVM () from
/usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
#14 0x00007ffff6db0af2 in getJNIEnv () at
/home/kanghua/hadoop-0.20.2/src/c++/libhdfs/hdfsJniHelper.c:455
#15 0x00007ffff6db048c in hdfsConnectAsUser (host=0x7ffff7f64f60 "",
port=0, user=0x0) at
/home/kanghua/hadoop-0.20.2/src/c++/libhdfs/hdfs.c:199
#16 0x00007ffff7201d8f in hdfs_connect (storage=0x7ffff8612000,
uri=0x7ffff7f65e70 "hdfs:///tmp/testenv/testfs8") at
/home/kanghua/workshop3.bak/hlfs/src/backend/hdfs_storage.c:59
#17 0x00007ffff720b738 in init_storage_handler (uri=0x7ffff7f65e70
"hdfs:///tmp/testenv/testfs8") at
/home/kanghua/workshop3.bak/hlfs/src/utils/storage_helper.c:68
#18 0x00007ffff7f9b284 in hlbs_create (filename=<value optimized out>,
options=0x7ffff860e3b0) at block/hlfs.c:286
#19 0x00007ffff7f92ac7 in bdrv_create_co_entry ()
#20 0x00007ffff7fb998b in coroutine_trampoline ()
#21 0x00007ffff5a3ff40 in ?? () from /lib/libc.so.6
#22 0x00007fffffffd780 in ?? ()
#23 0x0000000000000000 in ?? ()

The above debug info show jni will be used in coroutine. I do not
familay with coroutine, however I guess if coroutine not allow to
spawn a new thread? ,or it's stack corrupte with java jvm stack ? ,
For when I modify bdrv_create out of coroutine , it can work - connect
to hdfs without any probleme.

Please tell me there are what limitions about coroutine , and how can
I use jni in roroutine to avoid sigsegv , or how to avoid  run into
coroutine mode when create driver.


Thanks a lot ..............................

kanghua

Reply via email to