Jump to content
OpenSplice DDS Forum
Pepijn

Crash in take() in on_data_available()

Recommended Posts

My program crashes with the following backtrace. The error seems to happen deep inside the take() method.

I can try to make a smaller reproducible test case if needed, but I'm just not really sure what's going on. It seems to be trying to free a string property on the message. Why is it trying to free something, when this is the first message that comes in? Does it think there is a previous message that it needs to free?

*** Error in `/home/pi/rove_ws/control/EyeDriveRPI': free(): invalid pointer: 0x76ca56ec ***

Thread 29 "ListenerDispatc" received signal SIGABRT, Aborted.
[Switching to Thread 0x75743450 (LWP 17120)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x7699f824 in __GI_abort () at abort.c:89
#2  0x769d8f78 in __libc_message (do_abort=do_abort@entry=2, fmt=<optimized out>) at ../sysdeps/posix/libc_fatal.c:175
#3  0x769dfad4 in malloc_printerr (action=<optimized out>, str=0x76a92040 "free(): invalid pointer", ptr=<optimized out>, ar_ptr=<optimized out>) at malloc.c:5049
#4  0x769e0514 in _int_free (av=0x76aae794 <main_arena>, p=0x76ca56e4 <std::string::_Rep::_S_empty_rep_storage+4>, have_lock=<optimized out>) at malloc.c:3905
#5  0x76c638b0 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#6  0x76c63ba4 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#7  0x76ca9c58 in Operator::Control::id(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) () from /usr/local/lib/libOperator.so
#8  0x76ca97c4 in __Operator_Control__copyOut(void const*, void*) () from /usr/local/lib/libOperator.so
#9  0x76f59a84 in org::opensplice::sub::AnyDataReaderDelegate::flush_action(void*, cmn_sampleInfo_s*, void*) () from /usr/local/include/HDE/armv7l.linux/lib/libdcpsisocpp2.so
#10 0x76e144cc in cmn_samplesList_flush () from /usr/local/include/HDE/armv7l.linux/lib/libddskernel.so
#11 0x76f58078 in org::opensplice::sub::AnyDataReaderDelegate::take(u_dataReader_s*, dds::sub::status::DataState const&, dds::sub::detail::SamplesHolder&, unsigned int) ()
   from /usr/local/include/HDE/armv7l.linux/lib/libdcpsisocpp2.so
#12 0x0001d96c in dds::sub::detail::DataReader<Operator::Control>::take (this=<optimized out>, this=<optimized out>)
    at /usr/local/include/HDE/armv7l.linux/include/dcps/C++/isocpp2/dds/sub/detail/TDataReaderImpl.hpp:686
#13 dds::sub::DataReader<Operator::Control, dds::sub::detail::DataReader>::take (this=<optimized out>)
    at /usr/local/include/HDE/armv7l.linux/include/dcps/C++/isocpp2/dds/sub/detail/TDataReaderImpl.hpp:423
#14 0x0001dadc in RobotControlReaderListener::on_data_available (this=0x7efff2ec, dr=...) at /usr/local/include/RobotControlReaderListener.hpp:14
#15 0x0001f6e0 in dds::sub::detail::DataReader<Operator::Control>::listener_notify (this=<optimized out>, source=..., triggerMask=4096, eventData=0x764018a8, l=0x7efff2ec)
    at /usr/local/include/HDE/armv7l.linux/include/dcps/C++/isocpp2/dds/sub/detail/TDataReaderImpl.hpp:853
#16 0x76f24b2c in org::opensplice::core::EntityDelegate::listener_entity_notify(std::shared_ptr<org::opensplice::core::ObjectDelegate>, unsigned int, void*) ()
   from /usr/local/include/HDE/armv7l.linux/lib/libdcpsisocpp2.so
#17 0x76f22b28 in org::opensplice::core::ListenerDispatcher::eventHandler(v_listenerEvent_s*) () from /usr/local/include/HDE/armv7l.linux/lib/libdcpsisocpp2.so
#18 0x76f23030 in org::opensplice::core::ListenerDispatcher::processEvents() () from /usr/local/include/HDE/armv7l.linux/lib/libdcpsisocpp2.so
#19 0x76f23114 in org::opensplice::core::ListenerDispatcher::thread() () from /usr/local/include/HDE/armv7l.linux/lib/libdcpsisocpp2.so
#20 0x76f23160 in org::opensplice::core::ListenerDispatcher::threadWrapper(void*) () from /usr/local/include/HDE/armv7l.linux/lib/libdcpsisocpp2.so
#21 0x76d30440 in os_startRoutineWrapper () from /usr/local/include/HDE/armv7l.linux/lib/libddskernel.so
#22 0x76cc1fc4 in start_thread (arg=0x75743450) at pthread_create.c:335
#23 0x76a43bc8 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:76 from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

 

Share this post


Link to post
Share on other sites

To my future self, and others seeing really weird errors: Make sure all your code is compiled with the same compiler.

For some reason the Raspi binaries are compiled with GCC 4.9, and if you compile anything with anything else, you will suffer.

On a related note, you may need to recompile stuff for C++11 to work.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×