JNI本地代码中使用dlopen载入动态链接库随机Crash

薛定谔之死猫 码窑株式会社 码农  2009-07-30 06:33:50
环境:
RHEL AS4 U5
GCC 3.4.6
JDK 1.6

JVM偶发性Crash,发生在dlopen调用处,参数是写死在代码中的,就搞不懂时而成功时而失败,有经验的能不能帮忙分析下原因啊,谢先。

JVM崩溃日志的堆栈部分,太长了,没能全部贴出
Stack: [0xb7f90000,0xb7fe1000), sp=0xb7fdf1e8, free space=316k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libc.so.6+0x61bdb]
C [libc.so.6+0x62c30]
C [libc.so.6+0x647c9] calloc+0xf9
C [ld-linux.so.2+0x9761]
C [ld-linux.so.2+0x5969]
C [ld-linux.so.2+0x746c]
C [libc.so.6+0x100278]
C [ld-linux.so.2+0xc66e]
C [libc.so.6+0x100ab8] _dl_open+0x98
C [libdl.so.2+0xcb8]
C [ld-linux.so.2+0xc66e]
C [libdl.so.2+0x12bb]
C [libdl.so.2+0xd11] dlopen+0x41
C [libtsstubjni.so+0xbf7e] callServiceClientByName+0x133
C [libtsstubjni.so+0xc2cf] callServiceClientByManName+0x82
C [libtsstubjni.so+0xc455] execstubstr+0x94
C [libtsstubjni.so+0xc555] Java_com_ydtf_tbi_pmm_jni_TSJniStub_callTuxedoServiceStr+0x80
j com.ydtf.tbi.pmm.jni.TSJniStub.callTuxedoServiceStr(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;+0
j com.ydtf.tbi.pmm.jni.Test.main([Ljava/lang/String;)V+43
v ~StubRoutines::call_stub
V [libjvm.so+0x2b521d]
V [libjvm.so+0x43d9a8]
V [libjvm.so+0x2b50b0]
V [libjvm.so+0x2de4b6]
V [libjvm.so+0x2cfb5b]
C [java+0x1b98] JavaMain+0x2c8
C [libpthread.so.0+0x53cc]
...全文
235 点赞 收藏 5
写回复
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
救命啊
回复
(gdb) thread apply all where

Thread 18 (process 13994):
#0 0x007017a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0096e297 in pthread_join () from /lib/tls/libpthread.so.0
#2 0x0804dce8 in ContinueInNewThread ()
#3 0x080497f6 in main ()

Thread 17 (process 13996):
#0 0x007017a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0096fcf6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2 0x0097036e in pthread_cond_wait@GLIBC_2.0 () from /lib/tls/libpthread.so.0
#3 0x06428306 in Monitor::wait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#4 0x062604a5 in GCTaskManager::get_task () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#5 0x0626152b in GCTaskThread::run () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#6 0x0643e883 in java_start () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#7 0x0096d3cc in start_thread () from /lib/tls/libpthread.so.0
#8 0x007e696e in clone () from /lib/tls/libc.so.6

Thread 16 (process 13997):
#0 0x007017a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0096fcf6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2 0x0097036e in pthread_cond_wait@GLIBC_2.0 () from /lib/tls/libpthread.so.0
#3 0x06428306 in Monitor::wait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#4 0x062604a5 in GCTaskManager::get_task () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#5 0x0626152b in GCTaskThread::run () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#6 0x0643e883 in java_start () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#7 0x0096d3cc in start_thread () from /lib/tls/libpthread.so.0
#8 0x007e696e in clone () from /lib/tls/libc.so.6

Thread 15 (process 13998):
#0 0x007017a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0096fcf6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2 0x0097036e in pthread_cond_wait@GLIBC_2.0 () from /lib/tls/libpthread.so.0
---Type <return> to continue, or q <return> to quit---
#3 0x06428306 in Monitor::wait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#4 0x062604a5 in GCTaskManager::get_task () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#5 0x0626152b in GCTaskThread::run () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#6 0x0643e883 in java_start () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#7 0x0096d3cc in start_thread () from /lib/tls/libpthread.so.0
#8 0x007e696e in clone () from /lib/tls/libc.so.6

Thread 14 (process 13999):
#0 0x007017a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0096fcf6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2 0x0097036e in pthread_cond_wait@GLIBC_2.0 () from /lib/tls/libpthread.so.0
#3 0x06428306 in Monitor::wait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#4 0x062604a5 in GCTaskManager::get_task () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#5 0x0626152b in GCTaskThread::run () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#6 0x0643e883 in java_start () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#7 0x0096d3cc in start_thread () from /lib/tls/libpthread.so.0
#8 0x007e696e in clone () from /lib/tls/libc.so.6

Thread 13 (process 14000):
#0 0x007017a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0096fcf6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2 0x0097036e in pthread_cond_wait@GLIBC_2.0 () from /lib/tls/libpthread.so.0
#3 0x06428306 in Monitor::wait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#4 0x062604a5 in GCTaskManager::get_task () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#5 0x0626152b in GCTaskThread::run () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#6 0x0643e883 in java_start () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#7 0x0096d3cc in start_thread () from /lib/tls/libpthread.so.0
#8 0x007e696e in clone () from /lib/tls/libc.so.6

Thread 12 (process 14001):
#0 0x007017a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0096fcf6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2 0x0097036e in pthread_cond_wait@GLIBC_2.0 () from /lib/tls/libpthread.so.0
---Type <return> to continue, or q <return> to quit---
#3 0x06428306 in Monitor::wait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#4 0x062604a5 in GCTaskManager::get_task () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#5 0x0626152b in GCTaskThread::run () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#6 0x0643e883 in java_start () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#7 0x0096d3cc in start_thread () from /lib/tls/libpthread.so.0
#8 0x007e696e in clone () from /lib/tls/libc.so.6

Thread 11 (process 14002):
#0 0x007017a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0096fcf6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2 0x0097036e in pthread_cond_wait@GLIBC_2.0 () from /lib/tls/libpthread.so.0
#3 0x06428306 in Monitor::wait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#4 0x062604a5 in GCTaskManager::get_task () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#5 0x0626152b in GCTaskThread::run () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#6 0x0643e883 in java_start () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#7 0x0096d3cc in start_thread () from /lib/tls/libpthread.so.0
#8 0x007e696e in clone () from /lib/tls/libc.so.6

Thread 10 (process 14003):
#0 0x007017a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0096fcf6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2 0x0097036e in pthread_cond_wait@GLIBC_2.0 () from /lib/tls/libpthread.so.0
#3 0x06428306 in Monitor::wait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#4 0x062604a5 in GCTaskManager::get_task () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#5 0x0626152b in GCTaskThread::run () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#6 0x0643e883 in java_start () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#7 0x0096d3cc in start_thread () from /lib/tls/libpthread.so.0
#8 0x007e696e in clone () from /lib/tls/libc.so.6

Thread 9 (process 14004):
#0 0x007017a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0096ff7c in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2 0x009703f5 in pthread_cond_timedwait@GLIBC_2.0 () from /lib/tls/libpthread.so.0
---Type <return> to continue, or q <return> to quit---
#3 0x064283ae in Monitor::wait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#4 0x0652ef77 in VMThread::loop () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#5 0x0652e92f in VMThread::run () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#6 0x0643e883 in java_start () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#7 0x0096d3cc in start_thread () from /lib/tls/libpthread.so.0
#8 0x007e696e in clone () from /lib/tls/libc.so.6

Thread 8 (process 14005):
#0 0x007017a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0096fcf6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2 0x0097036e in pthread_cond_wait@GLIBC_2.0 () from /lib/tls/libpthread.so.0
#3 0x0643e459 in os::PlatformEvent::park () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#4 0x064c5975 in ObjectMonitor::wait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#5 0x064c31df in ObjectSynchronizer::wait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#6 0x0630746a in JVM_MonitorWait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#7 0xb4f3cb5b in ?? ()
#8 0x081834e8 in ?? ()
#9 0x70cd3eb0 in ?? ()
#10 0x00000000 in ?? ()

Thread 7 (process 14006):
#0 0x007017a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0096fcf6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2 0x0097036e in pthread_cond_wait@GLIBC_2.0 () from /lib/tls/libpthread.so.0
#3 0x0643e459 in os::PlatformEvent::park () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#4 0x064c5975 in ObjectMonitor::wait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#5 0x064c31df in ObjectSynchronizer::wait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#6 0x0630746a in JVM_MonitorWait () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#7 0xb4f3cb5b in ?? ()
#8 0x08183ce8 in ?? ()
#9 0x70c82ffc in ?? ()
#10 0x00000000 in ?? ()
回复
勤奋的沉沦 2009-07-31
等待 回答
回复
gdb java
>core-file core.xxxx
(gdb) bt
#0 0x007017a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x00742825 in raise () from /lib/tls/libc.so.6
#2 0x00744289 in abort () from /lib/tls/libc.so.6
#3 0x0643b36b in os::abort () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#4 0x0651c431 in VMError::report_and_die () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#5 0x0643f7a0 in JVM_handle_linux_signal () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#6 0x0643d058 in signalHandler () from /var/jdk/jdk1.6.0/jre/lib/i386/server/libjvm.so
#7 <signal handler called>
#8 0x0077cbdb in malloc_consolidate () from /lib/tls/libc.so.6
#9 0x0077dc30 in _int_malloc () from /lib/tls/libc.so.6
#10 0x0077f7c9 in calloc () from /lib/tls/libc.so.6
#11 0x0070a761 in _dl_new_object () from /lib/ld-linux.so.2
#12 0x00706969 in _dl_map_object_from_fd () from /lib/ld-linux.so.2
#13 0x0070846c in _dl_map_object () from /lib/ld-linux.so.2
#14 0x0081b278 in dl_open_worker () from /lib/tls/libc.so.6
#15 0x0070d66e in _dl_catch_error () from /lib/ld-linux.so.2
#16 0x0081bab8 in _dl_open () from /lib/tls/libc.so.6
#17 0x0084ccb8 in dlopen_doit () from /lib/libdl.so.2
#18 0x0070d66e in _dl_catch_error () from /lib/ld-linux.so.2
#19 0x0084d2bb in _dlerror_run () from /lib/libdl.so.2
#20 0x0084cd11 in dlopen@@GLIBC_2.1 () from /lib/libdl.so.2
#21 0x709fff7b in callServiceClientByName () from /home/tbicl/tuxapp/src/libtsstubjni.so
#22 0x70a002cc in callServiceClientByManName () from /home/tbicl/tuxapp/src/libtsstubjni.so
#23 0x70a00452 in execstubstr () from /home/tbicl/tuxapp/src/libtsstubjni.so
#24 0x70a00551 in Java_com_ydtf_tbi_pmm_jni_TSJniStub_callTuxedoServiceStr () from /home/tbicl/tuxapp/src/libtsstubjni.so
#25 0xb4f3cb5b in ?? ()
#26 0x080580e8 in ?? ()
#27 0xb7fe0040 in ?? ()
#28 0xb7fe004c in ?? ()
#29 0xb7fe0048 in ?? ()
#30 0x08058000 in ?? ()
#31 0x08058000 in ?? ()
#32 0xb7fe0018 in ?? ()
回复
自己顶
回复
发动态
发帖子
新手乐园
创建于2007-09-28

3.2w+

社区成员

C/C++ 新手乐园
申请成为版主
社区公告
暂无公告