Java调用OpenDDS订阅端接收数组崩溃,C++与Java消息转换异常
OpenDDS 3.13.2 Java订阅端接收数组数据时触发SIGSEGV异常
使用OpenDDS 3.13.2版本,Java订阅端接收包含double类型序列的结构体数据时,JVM触发致命SIGSEGV错误,错误发生在jni_GetArrayLength调用环节。
IDL定义
module InstructionManager { #pragma DCPS_DATA_TYPE "InstructionManager::Instruction" #pragma DCPS_DATA_KEY "InstructionManager::Instruction id" typedef sequence<double> DoubleSequence; struct Instruction { long long id; string code; string name; string params; double theTime; DoubleSequence values; long long timestamp; }; };
订阅端错误日志
Subscriber Matched (4276|140221489895168) StatusConditionImpl::get_trigger_value() - mask==0x4000, changes==0x0. (4276|140219595818752) DataLink::data_received_i: from publication 0103000c.291e7f8a.108a0000.00000002(fae6b69d) received sample: INSTANCE_REGISTRATION (0x02), Length: 16, Byte order: Little Endian, CDR Encapsulation, Key Fields Only, Sequence: 0x01, Timestamp: 1747393152.903646000, Publication: 0103000c.291e7f8a.108a0000.00000002(fae6b69d) to readerId 00000000.00000000.00000000.00000000(ecbb4b55) (SET_INCLUDED). (4276|140219595818752) DataLink::data_received_i - normal data received to each subscription in listener_set include ids: (4276|140219595818752) DataLink::data_received_i: from publication 0103000c.291e7f8a.108a0000.00000002(fae6b69d) received sample: SAMPLE_DATA (0x00), Length: 184, Byte order: Little Endian, CDR Encapsulation, Sequence: 0x02, Timestamp: 1747393152.904113000, Publication: 0103000c.291e7f8a.108a0000.00000002(fae6b69d) to readerId 00000000.00000000.00000000.00000000(ecbb4b55) (SET_INCLUDED). (4276|140219595818752) DataLink::data_received_i - normal data received to each subscription in listener_set include ids:0103000c.291e7f8a.10b40000.00000007(72d09c1d) (4276|140219595818752) DataReaderImpl::data_received: 0103000c.291e7f8a.10b40000.00000007(72d09c1d) received sample: SAMPLE_DATA (0x00), Length: 184, Byte order: Little Endian, CDR Encapsulation, Sequence: 0x02, Timestamp: 1747393152.904113000, Publication: 0103000c.291e7f8a.108a0000.00000002(fae6b69d). (4276|140219595818752) DataReaderImpl::writer_became_alive: reader 0103000c.291e7f8a.10b40000.00000007(72d09c1d) from writer 0103000c.291e7f8a.108a0000.00000002(fae6b69d) previous state NOT_SET. DataReaderListenerImpl.on_liveliness_changed (4276|140219595818752) ConditionImpl::signal_all() (4276|140219595818752) StatusConditionImpl::get_trigger_value() - mask==0x4000, changes==0x1000. (4276|140219595818752) DataReaderImpl::notify_liveliness_change: listener at 0x7821f888, mask 0xffffffff. NOTIFY: subscription 0103000c.291e7f8a.10b40000.00000007(72d09c1d), listener at: 0x0x7f877821f888 NOTIFY: writer[ 0103000c.291e7f8a.108a0000.00000002(fae6b69d)] == ALIVE (4276|140219595818752) ConditionImpl::signal_all() (4276|140219595818752) StatusConditionImpl::get_trigger_value() - mask==0xffffffff, changes==0x200. (4276|140219595818752) ConditionImpl::signal_all() - number of sets: 0, locally: 0. (4276|140221385553664) DataReaderImpl::handle_timeout: reader 0103000c.291e7f8a.10b40000.00000007(72d09c1d) has 0 live writers; from_reactor=0 1 2 3 # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f880a7c70db, pid=4276, tid=0x00007f876b330700 # # JRE version: Java(TM) SE Runtime Environment (8.0_451) (build 1.8.0_451-b10) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.451-b10 mixed mode linux-amd64 compressed oops) # Problematic frame: # V [libjvm.so+0x6bc0db] jni_GetArrayLength+0x4b # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # An error report file with more information is saved as: # /opt/OpenDDS-DDS-3.13.2/testDDS/sub/hs_err_pid4276.log # # If you would like to submit a bug report, please visit: # http://bugreport.java.com/bugreport/crash.jsp #
已定位到异常发生在消息转数组环节,推测是C++与Java之间的消息转换问题,但不确定是OpenDDS 3.13.2版本本身的bug,还是代码编写问题,寻求解决思路。
内容的提问来源于stack exchange,提问作者zyw
相关产品推荐
相关产品推荐

