Hi Gregg, Thanks for this important tip that the Java OcDeviceInfo class [1] is out-of-date in comparison with its counterpart OCDeviceInfo struct [2] in the C SDK, no wonder those uninitialized attributes in the OCDeviceInfo struct may cause core dumps. Very appreciated your below workaround, hopefully the development team will update the Java API soon in future releases to reflect the changes in the base API. Thanks again!
[1] https://api-docs.iotivity.org/latest-java/index.html [2] https://api-docs.iotivity.org/latest-c/struct_o_c_device_info.html Best Regards, Tonny On Wed, Aug 17, 2016 at 12:36 PM, Gregg Reynolds <dev at mobileink.com> wrote: > I don't know if this will help, but your bug looks like one I found > working with the Java API. OcDeviceInfo.java is broken; it only contains > two of the OcDeviceInfo fields, so when you pass it to registerDeviceInfo, > somewhere down in the stack something tries to read fields that do not > exist. > > Try adding something like the following to > Java_org_iotivity_base_OcPlatform_registerDeviceInfo0 > in JniOcPlatform.cpp. (see https://github.com/iotk/ > iochibity-java/blob/master/jni/JniOcPlatform.cpp) This is a hack, but it > works for me, for the moment. > > OCDeviceInfo deviceInfo = { > .deviceName = NULL, > .types = NULL, > .specVersion = NULL, > .dataModelVersions = NULL > }; > > HTH, > > Gregg > > On Tue, Aug 16, 2016 at 11:21 PM, Tonny Tzeng <tonny.tzeng at gmail.com> > wrote: > >> Hi, >> >> Does anyone successfully run the devicediscoveryserver example code in >> Android? it always crashes on my x86 tablet with the following stack trace, >> and it looks to me the abort was caused by calling OcPlatform.registerDev >> iceInfo(),so I am wondering whether there already has a fix for it? Any >> pointers would be very appreciated. Thanks. >> >> Best Regards, >> Tonny >> >> 08-17 03:57:30.173 3798-3816/com.intel.otc.brillo.examples.demo A/libc: >> Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4ac8ec32 in tid 3816 >> (Thread-4) >> ... >> 08-17 03:57:30.223 3822-3822/? A/DEBUG: *** *** *** *** *** *** *** *** >> *** *** *** *** *** *** *** *** >> 08-17 03:57:30.223 3822-3822/? A/DEBUG: Build fingerprint: >> 'Brillo/jaqen_edison/edison:7.0/NYC/tzeng07261729:eng/test-keys' >> 08-17 03:57:30.223 3822-3822/? A/DEBUG: Revision: '0' >> 08-17 03:57:30.223 3822-3822/? A/DEBUG: ABI: 'x86' >> 08-17 03:57:30.224 3822-3822/? A/DEBUG: pid: 3798, tid: 3816, name: >> Thread-4 >>> com.intel.otc.brillo.examples.demo <<< >> 08-17 03:57:30.224 3822-3822/? A/DEBUG: signal 11 (SIGSEGV), code 1 >> (SEGV_MAPERR), fault addr 0x4ac8ec32 >> 08-17 03:57:30.224 3822-3822/? A/DEBUG: eax a9ab9340 ebx ab411e74 >> ecx 4ac8ec2e edx 00000000 >> 08-17 03:57:30.224 3822-3822/? A/DEBUG: esi a9ab9340 edi 4ac8ec2e >> 08-17 03:57:30.225 3822-3822/? A/DEBUG: xcs 00000073 xds 0000007b >> xes 0000007b xfs 0000003b xss 0000007b >> 08-17 03:57:30.225 3822-3822/? A/DEBUG: eip ab3e898e ebp 9d4b9708 >> esp 9d4b96d4 flags 00010296 >> 08-17 03:57:30.235 3822-3822/? A/DEBUG: backtrace: >> 08-17 03:57:30.235 3822-3822/? A/DEBUG: #00 pc 0000e98e >> /data/app/com.intel.otc.brillo.examples.demo-1/lib/x86/liboctbstack.so >> (CloneOCStringLL+51) >> 08-17 03:57:30.235 3822-3822/? A/DEBUG: #01 pc 00014cc1 >> /data/app/com.intel.otc.brillo.examples.demo-1/lib/x86/liboctbstack.so >> (SaveDeviceInfo+301) >> 08-17 03:57:30.235 3822-3822/? A/DEBUG: #02 pc 0000b6be >> /data/app/com.intel.otc.brillo.examples.demo-1/lib/x86/liboctbstack.so >> (OCSetDeviceInfo+64) >> 08-17 03:57:30.235 3822-3822/? A/DEBUG: #03 pc 000537d0 >> /data/app/com.intel.otc.brillo.examples.demo-1/lib/x86/liboc.so >> (_ZN2OC19InProcServerWrapper18registerDeviceInfoE12OCDeviceInfo+84) >> 08-17 03:57:30.235 3822-3822/? A/DEBUG: #04 pc 0003cb4c >> /data/app/com.intel.otc.brillo.examples.demo-1/lib/x86/liboc.so >> (_ZN2OC9nil_guardIRSt10shared_ptrINS_14IServerWrapperEERMS2_ >> F13OCStackResult12OCDeviceInfoEIRKS6_EEES5_OT_OT0_DpOT1_+201) >> 08-17 03:57:30.235 3822-3822/? A/DEBUG: #05 pc 0003cbce >> /data/app/com.intel.otc.brillo.examples.demo-1/lib/x86/liboc.so >> (_ZN2OC15OCPlatform_impl18registerDeviceInfoE12OCDeviceInfo+52) >> 08-17 03:57:30.236 3822-3822/? A/DEBUG: #06 pc 000390f7 >> /data/app/com.intel.otc.brillo.examples.demo-1/lib/x86/liboc.so >> (_ZN2OC10OCPlatform18registerDeviceInfoE12OCDeviceInfo+46) >> 08-17 03:57:30.236 3822-3822/? A/DEBUG: #07 pc 000430ff >> /data/app/com.intel.otc.brillo.examples.demo-1/lib/x86/libocstack-jni.so >> (Java_org_iotivity_base_OcPlatform_registerDeviceInfo0+479) >> 08-17 03:57:30.236 3822-3822/? A/DEBUG: #08 pc 00021886 >> /data/app/com.intel.otc.brillo.examples.demo-1/oat/x86/base.odex >> (offset 0x1f000) >> >> >> _______________________________________________ >> iotivity-dev mailing list >> iotivity-dev at lists.iotivity.org >> https://lists.iotivity.org/mailman/listinfo/iotivity-dev >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160817/07bdd534/attachment.html>