问题背景
- 由于需求需要,需要使用rocketmq接收消息;到目前为止rocketmq虽然有提供c++访问rocketmq消息队列(githup工程代码路径:c++调用rocketmq),但是根据githup工程中提供的文档说明其在多个进程同时消费同一个消息队列是会存在消息重复的情况(GitHub文档路径,附上文档中说明会重复的截图:)
这是我业务上不允许出现的情况,所以目前通过c++访问的方式就放弃了;只能用c++通过jni调用java的写的代码了,好的是之前已经有人造好轮子了在unix(aix:xlc)上能正常稳定的运行了,只要移到我目标主机linux上即可。理论上是不会有什么问题,可以是由于系统差异最后还是遇到了坑爹的事情了,由于这套代码在aix上已经运行很久了且都没有异常过,到linux既然发现了在调用jni的CallObjectMethod时crash了也就core了,从一开始很长的一段时间一直都没有怀疑过是轮子问题,以为是自己环境没搞清楚,搞得也是无语了,后面也是弄了好久才解决的这里做个笔记先,当然文中可能帮不了你解决任何问题,但是可能能作为一个参考解决问题的思路。
问题现象
- 进程移植到linux平台过去后发现生产者能正常,就是消费者在消费几条消息之后就core了,发生了jvm的crash了具体如下:
core文件内容如下:
Missing separate debuginfo for /opt/java_default/jre/lib/amd64/server/libjvm.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/df/e156b65f2033a068019910920c63a70457b58e.debug
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Missing separate debuginfo for /opt/jdk1.8.0_91/jre/lib/amd64/libverify.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/22/7d54c375f0dd0cc195a4a08178545fcc262447.debug
Missing separate debuginfo for /opt/jdk1.8.0_91/jre/lib/amd64/libmanagement.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/c1/0632f81f87b3843d14a5a8888f10978ee361ea.debug
Core was generated by `testConsumer -a134.129.67.42:9876;134.129.67.43:9876 -gcid_repair_to_bill_topic'.
Program terminated with signal 6, Aborted.
#0 0x00007fcf105775f7 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.17-105.el7.x86_64 libgcc-4.8.5-4.el7.x86_64 libstdc++-4.8.5-4.el7.x86_64 zlib-1.2.7-15.el7.x86_64
(gdb) bt
#0 0x00007fcf105775f7 in raise () from /lib64/libc.so.6
#1 0x00007fcf10578ce8 in abort () from /lib64/libc.so.6
#2 0x00007fcf1231faa5 in os::abort(bool) () from /opt/java_default/jre/lib/amd64/server/libjvm.so
#3 0x00007fcf124be593 in VMError::report_and_die() () from /opt/java_default/jre/lib/amd64/server/libjvm.so
#4 0x00007fcf123252cf in JVM_handle_linux_signal () from /opt/java_default/jre/lib/amd64/server/libjvm.so
#5 0x00007fcf1231ba63 in signalHandler(int, siginfo*, void*) () from /opt/java_default/jre/lib/amd64/server/libjvm.so
#6 <signal handler called>
#7 0x00007fcf1210dcb3 in JNIHandleBlock::allocate_handle(oopDesc*) () from /opt/java_default/jre/lib/amd64/server/libjvm.so
#8 0x00007fcf120d231f in jni_invoke_nonstatic(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) ()
from /opt/java_default/jre/lib/amd64/server/libjvm.so
#9 0x00007fcf120d7ed1 in jni_CallObjectMethodV () from /opt/java_default/jre/lib/amd64/server/libjvm.so
#10 0x00007fcf1113336f in JNIEnv_::CallObjectMethod (this=0x146f9f8, obj=0xf8000e40, methodID=0x16a0898) at /opt/java_default/include/jni.h:901