Segfault when playing with MasterSlave activities

Hi all,

I have a very strange segfault that appens when I'm starting a Slave
Component.

For information, the master component is not started yet (it's maybe a bad
use, but it shouldn't segfault).

In short the problem is here :
#0 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
#1 0xb7f3cc54 in RTT::extras::SlaveActivity::trigger (this=0xaabdadc0)
at /opt/ros_addons/orocos_toolchain/rtt/rtt/extras/SlaveActivity.cpp:182
#2 0xb7edb36a in RTT::base::TaskCore::trigger (this=0xaabea998)
at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:100

But the associated lines seems Ok (as the pointer is checked) :

bool SlaveActivity::trigger()
{
if (mmaster)
return mmaster->trigger();
return false;
}

Here is the first lines of stack when segfaulting :

Program received signal SIGSEGV, Segmentation fault.
0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
(gdb) bt
#0 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
#1 0xb7f3cc54 in RTT::extras::SlaveActivity::trigger (this=0xaabdadc0)
at /opt/ros_addons/orocos_toolchain/rtt/rtt/extras/SlaveActivity.cpp:182
#2 0xb7edb36a in RTT::base::TaskCore::trigger (this=0xaabea998)
at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:100
#3 0xb7edb99d in RTT::base::TaskCore::start (this=0xaabea998)
at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:198
#4 0xb7e74f1c in RTT::TaskContext::start (this=0xaabea998)
at /opt/ros_addons/orocos_toolchain/rtt/rtt/TaskContext.cpp:399
#5 0xb7e8f355 in boost::_mfi::mf0<bool, RTT::TaskContext>::operator()
(this=0x9ecc20cc,
p=0xaabea998) at /usr/include/boost/bind/mem_fn_template.hpp:49
#6 0xb7e8e8f6 in boost::_bi::list1<boost::_bi::value<RTT::TaskContext*>
>::operator()<bool, boost::_mfi::mf0<bool, RTT::TaskContext>,
boost::_bi::list0> (this=0x9ecc20d4, f=..., a=...)
at /usr/include/boost/bind/bind.hpp:243
#7 0xb7e8e0d2 in boost::_bi::bind_t<boost::_bi::unspecified,
boost::_mfi::mf0<bool, RTT::TaskContext>,
boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >::operator()
(this=0x9ecc20cc)
at /usr/include/boost/bind/bind_template.hpp:20
#8 0xb7e8d7a0 in
boost::detail::function::function_obj_invoker0<boost::_bi::bind_t<boost::_bi::unspecified,
boost::_mfi::mf0<bool, RTT::TaskContext>,
boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >, bool>::invoke
(function_obj_ptr=...)
at /usr/include/boost/function/function_template.hpp:132
#9 0xb7ea4359 in boost::function0<bool>::operator() (this=0x9ecc20c8)
at /usr/include/boost/function/function_template.hpp:1013
#10 0xb7e9e377 in RTT::internal::LocalOperationCallerImpl<bool
()()>::call_impl() (
this=0x9ecc20b8)
at
/opt/ros_addons/orocos_toolchain/rtt/rtt/internal/../internal/LocalOperationCaller.hpp:335
#11 0xb7e981ab in RTT::internal::InvokerImpl<0, bool ()(),
RTT::internal::LocalOperationCallerImpl<bool ()()> >::call()
(this=0x9ecc20b8)
at
/opt/ros_addons/orocos_toolchain/rtt/rtt/internal/../internal/Invoker.hpp:75
#12 0xad4c87c9 in arp_core::Monitor::startHook() ()
from
/opt/ard/arp_core/lib/orocos/gnulinux/libarp_core-components-gnulinux.so
#13 0xb7edb97d in RTT::base::TaskCore::start (this=0xaabe2dc8)
at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:196
#14 0xb7e74f1c in RTT::TaskContext::start (this=0xaabe2dc8)
at /opt/ros_addons/orocos_toolchain/rtt/rtt/TaskContext.cpp:399
#15 0xb7e8f355 in boost::_mfi::mf0<bool, RTT::TaskContext>::operator()
(this=0x9ecc1fdc,
p=0xaabe2dc8) at /usr/include/boost/bind/mem_fn_template.hpp:49
#16 0xb7e8e8f6 in boost::_bi::list1<boost::_bi::value<RTT::TaskContext*>
>::operator()<bool, boost::_mfi::mf0<bool, RTT::TaskContext>,
boost::_bi::list0> (this=0x9ecc1fe4, f=..., a=...)
at /usr/include/boost/bind/bind.hpp:243

Segfault when playing with MasterSlave activities

Here is a second trace. The problem happens independantly of master's
state. I have the problem each time I try to start a Slave

Program received signal SIGSEGV, Segmentation fault.
0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
(gdb) bt
#0 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
#1 0xb7f3cc54 in RTT::extras::SlaveActivity::trigger (this=0xaa3e7030)
at /opt/ros_addons/orocos_toolchain/rtt/rtt/extras/SlaveActivity.cpp:182
#2 0xb7edb36a in RTT::base::TaskCore::trigger (this=0xaa3de990)
at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:100
#3 0xb7edb99d in RTT::base::TaskCore::start (this=0xaa3de990)
at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:198
#4 0xb7e74f1c in RTT::TaskContext::start (this=0xaa3de990)
at /opt/ros_addons/orocos_toolchain/rtt/rtt/TaskContext.cpp:399
#5 0xb7e8f355 in boost::_mfi::mf0<bool, RTT::TaskContext>::operator()
(this=0x9c92a744,
p=0xaa3de990) at /usr/include/boost/bind/mem_fn_template.hpp:49

I have rebuilt quite a lot of my packages to be sure it is not a
compilation issue, but I'm not really sure that I can't have forgottent
something.

2014-05-02 17:37 GMT+02:00 Willy Lambert <lambert [dot] willy [..] ...>:

> Hi all,
>
> I have a very strange segfault that appens when I'm starting a Slave
> Component.
>
> For information, the master component is not started yet (it's maybe a bad
> use, but it shouldn't segfault).
>
> In short the problem is here :
> #0 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
> #1 0xb7f3cc54 in RTT::extras::SlaveActivity::trigger (this=0xaabdadc0)
> at
> /opt/ros_addons/orocos_toolchain/rtt/rtt/extras/SlaveActivity.cpp:182
> #2 0xb7edb36a in RTT::base::TaskCore::trigger (this=0xaabea998)
> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:100
>
> But the associated lines seems Ok (as the pointer is checked) :
>
> bool SlaveActivity::trigger()
> {
> if (mmaster)
> return mmaster->trigger();
> return false;
> }
>
>
>
> Here is the first lines of stack when segfaulting :
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
> (gdb) bt
> #0 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
> #1 0xb7f3cc54 in RTT::extras::SlaveActivity::trigger (this=0xaabdadc0)
> at
> /opt/ros_addons/orocos_toolchain/rtt/rtt/extras/SlaveActivity.cpp:182
> #2 0xb7edb36a in RTT::base::TaskCore::trigger (this=0xaabea998)
> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:100
> #3 0xb7edb99d in RTT::base::TaskCore::start (this=0xaabea998)
> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:198
> #4 0xb7e74f1c in RTT::TaskContext::start (this=0xaabea998)
> at /opt/ros_addons/orocos_toolchain/rtt/rtt/TaskContext.cpp:399
> #5 0xb7e8f355 in boost::_mfi::mf0<bool, RTT::TaskContext>::operator()
> (this=0x9ecc20cc,
> p=0xaabea998) at /usr/include/boost/bind/mem_fn_template.hpp:49
> #6 0xb7e8e8f6 in boost::_bi::list1<boost::_bi::value<RTT::TaskContext*>
> >::operator()<bool, boost::_mfi::mf0<bool, RTT::TaskContext>,
> boost::_bi::list0> (this=0x9ecc20d4, f=..., a=...)
> at /usr/include/boost/bind/bind.hpp:243
> #7 0xb7e8e0d2 in boost::_bi::bind_t<boost::_bi::unspecified,
> boost::_mfi::mf0<bool, RTT::TaskContext>,
> boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >::operator()
> (this=0x9ecc20cc)
> at /usr/include/boost/bind/bind_template.hpp:20
> #8 0xb7e8d7a0 in
> boost::detail::function::function_obj_invoker0<boost::_bi::bind_t<boost::_bi::unspecified,
> boost::_mfi::mf0<bool, RTT::TaskContext>,
> boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >, bool>::invoke
> (function_obj_ptr=...)
> at /usr/include/boost/function/function_template.hpp:132
> #9 0xb7ea4359 in boost::function0<bool>::operator() (this=0x9ecc20c8)
> at /usr/include/boost/function/function_template.hpp:1013
> #10 0xb7e9e377 in RTT::internal::LocalOperationCallerImpl<bool
> ()()>::call_impl() (
> this=0x9ecc20b8)
> at
> /opt/ros_addons/orocos_toolchain/rtt/rtt/internal/../internal/LocalOperationCaller.hpp:335
> #11 0xb7e981ab in RTT::internal::InvokerImpl<0, bool ()(),
> RTT::internal::LocalOperationCallerImpl<bool ()()> >::call()
> (this=0x9ecc20b8)
> at
> /opt/ros_addons/orocos_toolchain/rtt/rtt/internal/../internal/Invoker.hpp:75
> #12 0xad4c87c9 in arp_core::Monitor::startHook() ()
> from
> /opt/ard/arp_core/lib/orocos/gnulinux/libarp_core-components-gnulinux.so
> #13 0xb7edb97d in RTT::base::TaskCore::start (this=0xaabe2dc8)
> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:196
> #14 0xb7e74f1c in RTT::TaskContext::start (this=0xaabe2dc8)
> at /opt/ros_addons/orocos_toolchain/rtt/rtt/TaskContext.cpp:399
> #15 0xb7e8f355 in boost::_mfi::mf0<bool, RTT::TaskContext>::operator()
> (this=0x9ecc1fdc,
> p=0xaabe2dc8) at /usr/include/boost/bind/mem_fn_template.hpp:49
> #16 0xb7e8e8f6 in boost::_bi::list1<boost::_bi::value<RTT::TaskContext*>
> >::operator()<bool, boost::_mfi::mf0<bool, RTT::TaskContext>,
> boost::_bi::list0> (this=0x9ecc1fe4, f=..., a=...)
> at /usr/include/boost/bind/bind.hpp:243
>
>

Segfault when playing with MasterSlave activities

2014-05-02 21:15 GMT+02:00 Peter Soetens <peter [..] ...>:

>
>
> Op vrijdag 2 mei 2014 heeft Willy Lambert <lambert [dot] willy [..] ...> het
> volgende geschreven:
>
> I'm on a 2.5 version, sorry I forgot to preicse the first time.
>>
>
> The error you're having is related to a corrupted virtual function table.
> I suggest to run your code against valgrind first, next check if you're
> loading outdated libraries in the orocos.log file and finally to indeed
> rebuild all packages.
>
> It's not a functional bug...
>
>
Ok, thanks for advices, I'll have a stronger look on my side.

> Peter
>
>
>
>>
>>
>> 2014-05-02 20:48 GMT+02:00 Willy Lambert <lambert [dot] willy [..] ...>:
>>
>> Here is a second trace. The problem happens independantly of master's
>> state. I have the problem each time I try to start a Slave
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
>> (gdb) bt
>> #0 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
>> #1 0xb7f3cc54 in RTT::extras::SlaveActivity::trigger (this=0xaa3e7030)
>> at
>> /opt/ros_addons/orocos_toolchain/rtt/rtt/extras/SlaveActivity.cpp:182
>> #2 0xb7edb36a in RTT::base::TaskCore::trigger (this=0xaa3de990)
>> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:100
>> #3 0xb7edb99d in RTT::base::TaskCore::start (this=0xaa3de990)
>> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:198
>> #4 0xb7e74f1c in RTT::TaskContext::start (this=0xaa3de990)
>> at /opt/ros_addons/orocos_toolchain/rtt/rtt/TaskContext.cpp:399
>> #5 0xb7e8f355 in boost::_mfi::mf0<bool, RTT::TaskContext>::operator()
>> (this=0x9c92a744,
>> p=0xaa3de990) at /usr/include/boost/bind/mem_fn_template.hpp:49
>>
>> I have rebuilt quite a lot of my packages to be sure it is not a
>> compilation issue, but I'm not really sure that I can't have forgottent
>> something.
>>
>>
>>
>> 2014-05-02 17:37 GMT+02:00 Willy Lambert <lambert [dot] willy [..] ...>:
>>
>> Hi all,
>>
>> I have a very strange segfault that appens when I'm starting a Slave
>> Component.
>>
>> For information, the master component is not started yet (it's maybe a
>> bad use, but it shouldn't segfault).
>>
>> In short the problem is here :
>> #0 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
>> #1 0xb7f3cc54 in RTT::extras::SlaveActivity::trigger (this=0xaabdadc0)
>> at
>> /opt/ros_addons/orocos_toolchain/rtt/rtt/extras/SlaveActivity.cpp:182
>> #2 0xb7edb36a in RTT::base::TaskCore::trigger (this=0xaabea998)
>> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:100
>>
>> But the associated lines seems Ok (as the pointer is checked) :
>>
>> bool SlaveActivity::trigger()
>> {
>> if (mmaster)
>> return mmaster->trigger();
>> return false;
>> }
>>
>>
>>
>> Here is the first lines of stack when segfaulting :
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
>> (gdb) bt
>> #0 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
>> #1 0xb7f3cc54 in RTT::extras::SlaveActivity::trigger (this=0xaabdadc0)
>> at
>> /opt/ros_addons/orocos_toolchain/rtt/rtt/extras/SlaveActivity.cpp:182
>> #2 0xb7edb36a in RTT::base::TaskCore::trigger (this=0xaabea998)
>> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:100
>> #3 0xb7edb99d in RTT::base::TaskCore::start (this=0xaabea998)
>> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:198
>> #4 0xb7e74f1c in RTT::TaskContext::start (this=0xaabea998)
>> at /opt/ros_addons/orocos_toolchain/rtt/rtt/TaskContext.cpp:399
>> #5 0xb7e8f355 in boost::_mfi::mf0<bool, RTT::TaskContext>::operator()
>> (this=0x9ecc20cc,
>> p=0xaabea998) at /usr/include/boost/bind/mem_fn_template.hpp:49
>> #6 0xb7e8e8f6 in boost::_bi::list1<boost::_bi::value<RTT::TaskContext*>
>> >::operator()<bool, boost::_mfi::mf0<bool, RTT::TaskContext>,
>> boost::_bi::list0> (this=0x9ecc20d4, f=..., a=...)
>> at /usr/include/boost/bind/bind.hpp:243
>> #7 0xb7e8e0d2 in boost::_bi::bind_t<boost::_bi::unspecified,
>> boost::_mfi::mf0<bool, RTT::TaskContext>,
>> boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >::operator()
>> (this=0x9ecc20cc)
>> at /usr/include/boost/bind/bind_template.hpp:20
>> #8 0xb7e8d7a0 in
>> boost::detail::function::function_obj_invoker0<boost::_bi::bind_t<boost::_bi::unspecified,
>> boost::_mfi::mf0<bool, RTT::TaskContext>,
>> boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >, bool>::invoke
>> (function_obj_ptr=...)
>> at /usr/include/boost/function/function_template.hpp:132
>> #9 0xb7ea4359 in boost::function0<bool>::operator() (this=0x9ecc20c8)
>> at /usr/include/boost/function/function_template.hpp:1013
>> #10 0xb7e9e377 in RTT::internal::LocalOperationCallerImpl<bool
>> ()()>::call_impl() (
>> this=0x9ecc20b8)
>> at /opt/ros_addons/orocos_
>>
>>
>>
>
> --
> Peter Soetens, Managing Director
> +32 473 170 240
> Intermodalics - Kapeldreef 60, 3001 Heverlee - BELGIUM
> www.intermodalics.eu
>

Segfault when playing with MasterSlave activities

2014-05-02 21:22 GMT+02:00 Willy Lambert <lambert [dot] willy [..] ...>:

>
>
>
> 2014-05-02 21:15 GMT+02:00 Peter Soetens <peter [..] ...>:
>
>
>>
>> Op vrijdag 2 mei 2014 heeft Willy Lambert <lambert [dot] willy [..] ...> het
>> volgende geschreven:
>>
>> I'm on a 2.5 version, sorry I forgot to preicse the first time.
>>>
>>
>> The error you're having is related to a corrupted virtual function table.
>> I suggest to run your code against valgrind first, next check if you're
>> loading outdated libraries in the orocos.log file and finally to indeed
>> rebuild all packages.
>>
>> It's not a functional bug...
>>
>>
>
Here are some entries that I can't link to my code at my comprehension
leve. Note that I'm using an own-child of fbsched:

==18518== Invalid read of size 4
==18518== at 0x42D3C42: RTT::extras::SlaveActivity::trigger()
(SlaveActivity.cpp:182)
==18518== by 0x4272369: RTT::base::TaskCore::trigger() (TaskCore.cpp:100)
==18518== by 0x427299C: RTT::base::TaskCore::start() (TaskCore.cpp:198)
==18518== by 0x420BF1B: RTT::TaskContext::start() (TaskContext.cpp:399)
==18518== by 0x4226354: boost::_mfi::mf0<bool,
RTT::TaskContext>::operator()(RTT::TaskContext*) const
(mem_fn_template.hpp:49)
==18518== by 0x42258F5: bool
boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> >::operator()<bool,
boost::_mfi::mf0<bool, RTT::TaskContext>,
boost::_bi::list0>(boost::_bi::type<bool>, boost::_mfi::mf0<bool,
RTT::TaskContext>&, boost::_bi::list0&, long) (bind.hpp:243)
==18518== by 0x42250D1: boost::_bi::bind_t<boost::_bi::unspecified,
boost::_mfi::mf0<bool, RTT::TaskContext>,
boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >::operator()()
(bind_template.hpp:20)
==18518== by 0x422479F:
boost::detail::function::function_obj_invoker0<boost::_bi::bind_t<boost::_bi::unspecified,
boost::_mfi::mf0<bool, RTT::TaskContext>,
boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >,
bool>::invoke(boost::detail::function::function_buffer&)
(function_template.hpp:132)
==18518== by 0x423B358: boost::function0<bool>::operator()() const
(function_template.hpp:1013)
==18518== by 0x4235376: RTT::internal::LocalOperationCallerImpl<bool
()()>::call_impl() (LocalOperationCaller.hpp:335)
==18518== by 0x422F1AA: RTT::internal::InvokerImpl<0, bool ()(),
RTT::internal::LocalOperationCallerImpl<bool ()()> >::call()
(Invoker.hpp:75)
==18518== by 0x4250FCE: bool boost::fusion::detail::invoke_mem_fn<bool
(RTT::base::OperationCallerBase<bool ()()>::*)(),
boost::fusion::cons<RTT::base::OperationCallerBase<bool ()()>*,
boost::fusion::vector<boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_> > const, 1, false>::call<bool
(RTT::base::OperationCallerBase<bool ()()>::*)()>(bool
(RTT::base::OperationCallerBase<bool ()()>::*&)(),
boost::fusion::cons<RTT::base::OperationCallerBase<bool ()()>*,
boost::fusion::vector<boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_> > const&) (invoke.hpp:279)
==18518== Address 0x9763918 is 0 bytes inside a block of size 148 free'd
==18518== at 0x4024881: operator delete(void*) (vg_replace_malloc.c:387)
==18518== by 0x41F186F: RTT::Activity::~Activity() (Activity.cpp:83)
==18518== by 0x4210D2D: void
boost::checked_delete<RTT::Activity>(RTT::Activity*) (checked_delete.hpp:34)
==18518== by 0x422B331:
boost::detail::sp_counted_impl_p<RTT::Activity>::dispose()
(sp_counted_impl.hpp:78)
==18518== by 0x41E4A1B: boost::detail::sp_counted_base::release()
(sp_counted_base_gcc_x86.hpp:145)
==18518== by 0x41E4A9F: boost::detail::shared_count::~shared_count()
(shared_count.hpp:217)
==18518== by 0x420CC67:
boost::shared_ptr<RTT::base::ActivityInterface>::~shared_ptr()
(shared_ptr.hpp:169)
==18518== by 0x420E0AF:
boost::shared_ptr<RTT::base::ActivityInterface>::operator=(boost::shared_ptr<RTT::base::ActivityInterface>
const&) (shared_ptr.hpp:305)
==18518== by 0x420BCEC:
RTT::TaskContext::setActivity(RTT::base::ActivityInterface*)
(TaskContext.cpp:351)
==18518== by 0x44B42FA:
OCL::DeploymentComponent::setActivity(std::string const&, double, int, int)
(DeploymentComponent.cpp:1661)
==18518== by 0x44CEA38:
boost::detail::function::function_obj_invoker4<boost::_bi::bind_t<boost::_bi::unspecified,
boost::_mfi::mf4<bool, OCL::DeploymentComponent, std::string const&,
double, int, int>,
boost::_bi::list5<boost::_bi::value<OCL::DeploymentComponent*>,
boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4> > >, bool,
std::string const&, double, int,
int>::invoke(boost::detail::function::function_buffer&, std::string const&,
double, int, int) (mem_fn_template.hpp:506)
==18518== by 0x44F54CC: RTT::internal::InvokerImpl<4, bool
()(std::string const&, double, int, int),
RTT::internal::LocalOperationCallerImpl<bool ()(std::string const&, double,
int, int)> >::call(std::string const&, double, int, int)
(function_template.hpp:1013)
==18518==
pure virtual method called
terminate called without an active exception
==18518== Thread 11:
==18518== Invalid read of size 4
==18518== at 0x42D38B0: RTT::extras::SlaveActivity::getPeriod() const
(SlaveActivity.cpp:69)
==18518== by 0x4272E43: RTT::base::TaskCore::getPeriod() const
(TaskCore.cpp:274)
==18518== by 0x10B748AA: arp_core::SimulatedRtc::updateHook() (in
/opt/ard/arp_core/lib/orocos/gnulinux/libarp_core-components-gnulinux.so)
==18518== by 0x425B65F: RTT::ExecutionEngine::processChildren()
(ExecutionEngine.cpp:331)
==18518== by 0x425B5E0: RTT::ExecutionEngine::step()
(ExecutionEngine.cpp:321)
==18518== by 0x4281145: RTT::base::RunnableInterface::loop()
(CoreRunnableInterface.cpp:60)
==18518== by 0x42D3CCE: RTT::extras::SlaveActivity::execute()
(SlaveActivity.cpp:194)
==18518== by 0x427230F: RTT::base::TaskCore::update() (TaskCore.cpp:93)
==18518== by 0x109E3208: FBSched::updateHook() (fbsched.cpp:91)
==18518== by 0x10B37E49: arp_core::PeriodicScheduler::updateHook() (in
/opt/ard/arp_core/lib/orocos/gnulinux/libarp_core-components-gnulinux.so)
==18518== by 0x425B65F: RTT::ExecutionEngine::processChildren()
(ExecutionEngine.cpp:331)
==18518== by 0x425B5E0: RTT::ExecutionEngine::step()
(ExecutionEngine.cpp:321)
==18518== Address 0x9763918 is 0 bytes inside a block of size 148 free'd
==18518== at 0x4024881: operator delete(void*) (vg_replace_malloc.c:387)
==18518== by 0x41F186F: RTT::Activity::~Activity() (Activity.cpp:83)
==18518== by 0x4210D2D: void
boost::checked_delete<RTT::Activity>(RTT::Activity*) (checked_delete.hpp:34)
==18518== by 0x422B331:
boost::detail::sp_counted_impl_p<RTT::Activity>::dispose()
(sp_counted_impl.hpp:78)
==18518== by 0x41E4A1B: boost::detail::sp_counted_base::release()
(sp_counted_base_gcc_x86.hpp:145)
==18518== by 0x41E4A9F: boost::detail::shared_count::~shared_count()
(shared_count.hpp:217)
==18518== by 0x420CC67:
boost::shared_ptr<RTT::base::ActivityInterface>::~shared_ptr()
(shared_ptr.hpp:169)
==18518== by 0x420E0AF:
boost::shared_ptr<RTT::base::ActivityInterface>::operator=(boost::shared_ptr<RTT::base::ActivityInterface>
const&) (shared_ptr.hpp:305)
==18518== by 0x420BCEC:
RTT::TaskContext::setActivity(RTT::base::ActivityInterface*)
(TaskContext.cpp:351)
==18518== by 0x44B42FA:
OCL::DeploymentComponent::setActivity(std::string const&, double, int, int)
(DeploymentComponent.cpp:1661)
==18518== by 0x44CEA38:
boost::detail::function::function_obj_invoker4<boost::_bi::bind_t<boost::_bi::unspecified,
boost::_mfi::mf4<bool, OCL::DeploymentComponent, std::string const&,
double, int, int>,
boost::_bi::list5<boost::_bi::value<OCL::DeploymentComponent*>,
boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4> > >, bool,
std::string const&, double, int,
int>::invoke(boost::detail::function::function_buffer&, std::string const&,
double, int, int) (mem_fn_template.hpp:506)
==18518== by 0x44F54CC: RTT::internal::InvokerImpl<4, bool
()(std::string const&, double, int, int),
RTT::internal::LocalOperationCallerImpl<bool ()(std::string const&, double,
int, int)> >::call(std::string const&, double, int, int)
(function_template.hpp:1013)
==18518==
pure virtual method called
==18518== Thread 25:
==18518== Invalid free() / delete / delete[]
==18518== at 0x4024B6A: free (vg_replace_malloc.c:366)
==18518== by 0x55E3623: free_mem (in /lib/i686/cmov/libc-2.11.3.so)
==18518== by 0x55E30E9: __libc_freeres (in /lib/i686/cmov/libc-2.11.3.so)
==18518== by 0x401F4D3: _vgnU_freeres (vg_preloaded.c:62)
==18518== by 0xDF1E44F: ???
==18518== by 0x42712A1: RTT::os::rtos_task_wait_period(RTOS_TASK*)
(fosi_internal.cpp:212)
==18518== by 0x4268FBC: RTT::os::thread_function(void*) (Thread.cpp:161)
==18518== by 0x4761954: start_thread (pthread_create.c:300)
==18518== by 0x55A25ED: clone (clone.S:130)
==18518== Address 0x54b7a10 is not stack'd, malloc'd or (recently) free'd

Segfault when playing with MasterSlave activities

Ok, we're getting close...

On Fri, May 2, 2014 at 9:33 PM, Willy Lambert <lambert [dot] willy [..] ...> wrote:
>
>
>
> 2014-05-02 21:22 GMT+02:00 Willy Lambert <lambert [dot] willy [..] ...>:
>
>>
>>
>>
>> 2014-05-02 21:15 GMT+02:00 Peter Soetens <peter [..] ...>:
>>
>>>
>>>
>>> Op vrijdag 2 mei 2014 heeft Willy Lambert <lambert [dot] willy [..] ...> het
>>> volgende geschreven:
>>>
>>>> I'm on a 2.5 version, sorry I forgot to preicse the first time.
>>>
>>>
>>> The error you're having is related to a corrupted virtual function table.
>>> I suggest to run your code against valgrind first, next check if you're
>>> loading outdated libraries in the orocos.log file and finally to indeed
>>> rebuild all packages.
>>>
>>> It's not a functional bug...
>>>
>>
>
> Here are some entries that I can't link to my code at my comprehension leve.
> Note that I'm using an own-child of fbsched:
>
> ==18518== Invalid read of size 4
> ==18518== at 0x42D3C42: RTT::extras::SlaveActivity::trigger()
> (SlaveActivity.cpp:182)
> ==18518== by 0x4272369: RTT::base::TaskCore::trigger() (TaskCore.cpp:100)
> ==18518== by 0x427299C: RTT::base::TaskCore::start() (TaskCore.cpp:198)
> ==18518== by 0x420BF1B: RTT::TaskContext::start() (TaskContext.cpp:399)
> ==18518== by 0x4226354: boost::_mfi::mf0<bool,
> RTT::TaskContext>::operator()(RTT::TaskContext*) const
> (mem_fn_template.hpp:49)
> ==18518== by 0x42258F5: bool
> boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> >::operator()<bool,
> boost::_mfi::mf0<bool, RTT::TaskContext>,
> boost::_bi::list0>(boost::_bi::type<bool>, boost::_mfi::mf0<bool,
> RTT::TaskContext>&, boost::_bi::list0&, long) (bind.hpp:243)
> ==18518== by 0x42250D1: boost::_bi::bind_t<boost::_bi::unspecified,
> boost::_mfi::mf0<bool, RTT::TaskContext>,
> boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >::operator()()
> (bind_template.hpp:20)
> ==18518== by 0x422479F:
> boost::detail::function::function_obj_invoker0<boost::_bi::bind_t<boost::_bi::unspecified,
> boost::_mfi::mf0<bool, RTT::TaskContext>,
> boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >,
> bool>::invoke(boost::detail::function::function_buffer&)
> (function_template.hpp:132)
> ==18518== by 0x423B358: boost::function0<bool>::operator()() const
> (function_template.hpp:1013)
> ==18518== by 0x4235376: RTT::internal::LocalOperationCallerImpl<bool
> ()()>::call_impl() (LocalOperationCaller.hpp:335)
> ==18518== by 0x422F1AA: RTT::internal::InvokerImpl<0, bool ()(),
> RTT::internal::LocalOperationCallerImpl<bool ()()> >::call()
> (Invoker.hpp:75)
> ==18518== by 0x4250FCE: bool boost::fusion::detail::invoke_mem_fn<bool
> (RTT::base::OperationCallerBase<bool ()()>::*)(),
> boost::fusion::cons<RTT::base::OperationCallerBase<bool ()()>*,
> boost::fusion::vector<boost::fusion::void_, boost::fusion::void_,
> boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
> boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
> boost::fusion::void_, boost::fusion::void_> > const, 1, false>::call<bool
> (RTT::base::OperationCallerBase<bool ()()>::*)()>(bool
> (RTT::base::OperationCallerBase<bool ()()>::*&)(),
> boost::fusion::cons<RTT::base::OperationCallerBase<bool ()()>*,
> boost::fusion::vector<boost::fusion::void_, boost::fusion::void_,
> boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
> boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
> boost::fusion::void_, boost::fusion::void_> > const&) (invoke.hpp:279)
> ==18518== Address 0x9763918 is 0 bytes inside a block of size 148 free'd
> ==18518== at 0x4024881: operator delete(void*) (vg_replace_malloc.c:387)
> ==18518== by 0x41F186F: RTT::Activity::~Activity() (Activity.cpp:83)
> ==18518== by 0x4210D2D: void
> boost::checked_delete<RTT::Activity>(RTT::Activity*) (checked_delete.hpp:34)
> ==18518== by 0x422B331:
> boost::detail::sp_counted_impl_p<RTT::Activity>::dispose()
> (sp_counted_impl.hpp:78)
> ==18518== by 0x41E4A1B: boost::detail::sp_counted_base::release()
> (sp_counted_base_gcc_x86.hpp:145)
> ==18518== by 0x41E4A9F: boost::detail::shared_count::~shared_count()
> (shared_count.hpp:217)
> ==18518== by 0x420CC67:
> boost::shared_ptr<RTT::base::ActivityInterface>::~shared_ptr()
> (shared_ptr.hpp:169)
> ==18518== by 0x420E0AF:
> boost::shared_ptr<RTT::base::ActivityInterface>::operator=(boost::shared_ptr<RTT::base::ActivityInterface>
> const&) (shared_ptr.hpp:305)
> ==18518== by 0x420BCEC:
> RTT::TaskContext::setActivity(RTT::base::ActivityInterface*)
> (TaskContext.cpp:351)
> ==18518== by 0x44B42FA: OCL::DeploymentComponent::setActivity(std::string
> const&, double, int, int) (DeploymentComponent.cpp:1661)
> ==18518== by 0x44CEA38:
> boost::detail::function::function_obj_invoker4<boost::_bi::bind_t<boost::_bi::unspecified,
> boost::_mfi::mf4<bool, OCL::DeploymentComponent, std::string const&, double,
> int, int>, boost::_bi::list5<boost::_bi::value<OCL::DeploymentComponent*>,
> boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4> > >, bool,
> std::string const&, double, int,
> int>::invoke(boost::detail::function::function_buffer&, std::string const&,
> double, int, int) (mem_fn_template.hpp:506)
> ==18518== by 0x44F54CC: RTT::internal::InvokerImpl<4, bool ()(std::string
> const&, double, int, int), RTT::internal::LocalOperationCallerImpl<bool
> ()(std::string const&, double, int, int)> >::call(std::string const&,
> double, int, int) (function_template.hpp:1013)
> ==18518==

So it's saying you're trying to access a pointer in SlaveActivity
which was freed before by setActivity. You should first set your
master activity and then your slave activity, not the other way
around.

Are you using a deployment script ?

Peter

> pure virtual method called
> terminate called without an active exception
> ==18518== Thread 11:
> ==18518== Invalid read of size 4
> ==18518== at 0x42D38B0: RTT::extras::SlaveActivity::getPeriod() const
> (SlaveActivity.cpp:69)
> ==18518== by 0x4272E43: RTT::base::TaskCore::getPeriod() const
> (TaskCore.cpp:274)
> ==18518== by 0x10B748AA: arp_core::SimulatedRtc::updateHook() (in
> /opt/ard/arp_core/lib/orocos/gnulinux/libarp_core-components-gnulinux.so)
> ==18518== by 0x425B65F: RTT::ExecutionEngine::processChildren()
> (ExecutionEngine.cpp:331)
> ==18518== by 0x425B5E0: RTT::ExecutionEngine::step()
> (ExecutionEngine.cpp:321)
> ==18518== by 0x4281145: RTT::base::RunnableInterface::loop()
> (CoreRunnableInterface.cpp:60)
> ==18518== by 0x42D3CCE: RTT::extras::SlaveActivity::execute()
> (SlaveActivity.cpp:194)
> ==18518== by 0x427230F: RTT::base::TaskCore::update() (TaskCore.cpp:93)
> ==18518== by 0x109E3208: FBSched::updateHook() (fbsched.cpp:91)
> ==18518== by 0x10B37E49: arp_core::PeriodicScheduler::updateHook() (in
> /opt/ard/arp_core/lib/orocos/gnulinux/libarp_core-components-gnulinux.so)
> ==18518== by 0x425B65F: RTT::ExecutionEngine::processChildren()
> (ExecutionEngine.cpp:331)
> ==18518== by 0x425B5E0: RTT::ExecutionEngine::step()
> (ExecutionEngine.cpp:321)
> ==18518== Address 0x9763918 is 0 bytes inside a block of size 148 free'd
> ==18518== at 0x4024881: operator delete(void*) (vg_replace_malloc.c:387)
> ==18518== by 0x41F186F: RTT::Activity::~Activity() (Activity.cpp:83)
> ==18518== by 0x4210D2D: void
> boost::checked_delete<RTT::Activity>(RTT::Activity*) (checked_delete.hpp:34)
> ==18518== by 0x422B331:
> boost::detail::sp_counted_impl_p<RTT::Activity>::dispose()
> (sp_counted_impl.hpp:78)
> ==18518== by 0x41E4A1B: boost::detail::sp_counted_base::release()
> (sp_counted_base_gcc_x86.hpp:145)
> ==18518== by 0x41E4A9F: boost::detail::shared_count::~shared_count()
> (shared_count.hpp:217)
> ==18518== by 0x420CC67:
> boost::shared_ptr<RTT::base::ActivityInterface>::~shared_ptr()
> (shared_ptr.hpp:169)
> ==18518== by 0x420E0AF:
> boost::shared_ptr<RTT::base::ActivityInterface>::operator=(boost::shared_ptr<RTT::base::ActivityInterface>
> const&) (shared_ptr.hpp:305)
> ==18518== by 0x420BCEC:
> RTT::TaskContext::setActivity(RTT::base::ActivityInterface*)
> (TaskContext.cpp:351)
> ==18518== by 0x44B42FA: OCL::DeploymentComponent::setActivity(std::string
> const&, double, int, int) (DeploymentComponent.cpp:1661)
> ==18518== by 0x44CEA38:
> boost::detail::function::function_obj_invoker4<boost::_bi::bind_t<boost::_bi::unspecified,
> boost::_mfi::mf4<bool, OCL::DeploymentComponent, std::string const&, double,
> int, int>, boost::_bi::list5<boost::_bi::value<OCL::DeploymentComponent*>,
> boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4> > >, bool,
> std::string const&, double, int,
> int>::invoke(boost::detail::function::function_buffer&, std::string const&,
> double, int, int) (mem_fn_template.hpp:506)
> ==18518== by 0x44F54CC: RTT::internal::InvokerImpl<4, bool ()(std::string
> const&, double, int, int), RTT::internal::LocalOperationCallerImpl<bool
> ()(std::string const&, double, int, int)> >::call(std::string const&,
> double, int, int) (function_template.hpp:1013)
> ==18518==
> pure virtual method called
> ==18518== Thread 25:
> ==18518== Invalid free() / delete / delete[]
> ==18518== at 0x4024B6A: free (vg_replace_malloc.c:366)
> ==18518== by 0x55E3623: free_mem (in /lib/i686/cmov/libc-2.11.3.so)
> ==18518== by 0x55E30E9: __libc_freeres (in /lib/i686/cmov/libc-2.11.3.so)
> ==18518== by 0x401F4D3: _vgnU_freeres (vg_preloaded.c:62)
> ==18518== by 0xDF1E44F: ???
> ==18518== by 0x42712A1: RTT::os::rtos_task_wait_period(RTOS_TASK*)
> (fosi_internal.cpp:212)
> ==18518== by 0x4268FBC: RTT::os::thread_function(void*) (Thread.cpp:161)
> ==18518== by 0x4761954: start_thread (pthread_create.c:300)
> ==18518== by 0x55A25ED: clone (clone.S:130)
> ==18518== Address 0x54b7a10 is not stack'd, malloc'd or (recently) free'd
>
>

Segfault when playing with MasterSlave activities

2014-05-02 22:28 GMT+02:00 Peter Soetens <peter [..] ...>:

> Ok, we're getting close...
>

I recompiled everything to be sure I'm not in a trivial build issue and I
still have the problem.

>
> On Fri, May 2, 2014 at 9:33 PM, Willy Lambert <lambert [dot] willy [..] ...>
> wrote:
> >
> >
> >
> > 2014-05-02 21:22 GMT+02:00 Willy Lambert <lambert [dot] willy [..] ...>:
> >
> >>
> >>
> >>
> >> 2014-05-02 21:15 GMT+02:00 Peter Soetens <peter [..] ...>:
> >>
> >>>
> >>>
> >>> Op vrijdag 2 mei 2014 heeft Willy Lambert <lambert [dot] willy [..] ...>
> het
> >>> volgende geschreven:
> >>>
> >>>> I'm on a 2.5 version, sorry I forgot to preicse the first time.
> >>>
> >>>
> >>> The error you're having is related to a corrupted virtual function
> table.
> >>> I suggest to run your code against valgrind first, next check if you're
> >>> loading outdated libraries in the orocos.log file and finally to indeed
> >>> rebuild all packages.
> >>>
> >>> It's not a functional bug...
> >>>
> >>
> >
> > Here are some entries that I can't link to my code at my comprehension
> leve.
> > Note that I'm using an own-child of fbsched:
> >
> > ==18518== Invalid read of size 4
> > ==18518== at 0x42D3C42: RTT::extras::SlaveActivity::trigger()
> > (SlaveActivity.cpp:182)
> > ==18518== by 0x4272369: RTT::base::TaskCore::trigger()
> (TaskCore.cpp:100)
> > ==18518== by 0x427299C: RTT::base::TaskCore::start()
> (TaskCore.cpp:198)
> > ==18518== by 0x420BF1B: RTT::TaskContext::start()
> (TaskContext.cpp:399)
> > ==18518== by 0x4226354: boost::_mfi::mf0<bool,
> > RTT::TaskContext>::operator()(RTT::TaskContext*) const
> > (mem_fn_template.hpp:49)
> > ==18518== by 0x42258F5: bool
> > boost::_bi::list1<boost::_bi::value<RTT::TaskContext*>
> >::operator()<bool,
> > boost::_mfi::mf0<bool, RTT::TaskContext>,
> > boost::_bi::list0>(boost::_bi::type<bool>, boost::_mfi::mf0<bool,
> > RTT::TaskContext>&, boost::_bi::list0&, long) (bind.hpp:243)
> > ==18518== by 0x42250D1: boost::_bi::bind_t<boost::_bi::unspecified,
> > boost::_mfi::mf0<bool, RTT::TaskContext>,
> > boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >::operator()()
> > (bind_template.hpp:20)
> > ==18518== by 0x422479F:
> >
> boost::detail::function::function_obj_invoker0<boost::_bi::bind_t<boost::_bi::unspecified,
> > boost::_mfi::mf0<bool, RTT::TaskContext>,
> > boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >,
> > bool>::invoke(boost::detail::function::function_buffer&)
> > (function_template.hpp:132)
> > ==18518== by 0x423B358: boost::function0<bool>::operator()() const
> > (function_template.hpp:1013)
> > ==18518== by 0x4235376: RTT::internal::LocalOperationCallerImpl<bool
> > ()()>::call_impl() (LocalOperationCaller.hpp:335)
> > ==18518== by 0x422F1AA: RTT::internal::InvokerImpl<0, bool ()(),
> > RTT::internal::LocalOperationCallerImpl<bool ()()> >::call()
> > (Invoker.hpp:75)
> > ==18518== by 0x4250FCE: bool boost::fusion::detail::invoke_mem_fn<bool
> > (RTT::base::OperationCallerBase<bool ()()>::*)(),
> > boost::fusion::cons<RTT::base::OperationCallerBase<bool ()()>*,
> > boost::fusion::vector<boost::fusion::void_, boost::fusion::void_,
> > boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
> > boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
> > boost::fusion::void_, boost::fusion::void_> > const, 1, false>::call<bool
> > (RTT::base::OperationCallerBase<bool ()()>::*)()>(bool
> > (RTT::base::OperationCallerBase<bool ()()>::*&)(),
> > boost::fusion::cons<RTT::base::OperationCallerBase<bool ()()>*,
> > boost::fusion::vector<boost::fusion::void_, boost::fusion::void_,
> > boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
> > boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
> > boost::fusion::void_, boost::fusion::void_> > const&) (invoke.hpp:279)
> > ==18518== Address 0x9763918 is 0 bytes inside a block of size 148 free'd
> > ==18518== at 0x4024881: operator delete(void*)
> (vg_replace_malloc.c:387)
> > ==18518== by 0x41F186F: RTT::Activity::~Activity() (Activity.cpp:83)
> > ==18518== by 0x4210D2D: void
> > boost::checked_delete<RTT::Activity>(RTT::Activity*)
> (checked_delete.hpp:34)
> > ==18518== by 0x422B331:
> > boost::detail::sp_counted_impl_p<RTT::Activity>::dispose()
> > (sp_counted_impl.hpp:78)
> > ==18518== by 0x41E4A1B: boost::detail::sp_counted_base::release()
> > (sp_counted_base_gcc_x86.hpp:145)
> > ==18518== by 0x41E4A9F: boost::detail::shared_count::~shared_count()
> > (shared_count.hpp:217)
> > ==18518== by 0x420CC67:
> > boost::shared_ptr<RTT::base::ActivityInterface>::~shared_ptr()
> > (shared_ptr.hpp:169)
> > ==18518== by 0x420E0AF:
> >
> boost::shared_ptr<RTT::base::ActivityInterface>::operator=(boost::shared_ptr<RTT::base::ActivityInterface>
> > const&) (shared_ptr.hpp:305)
> > ==18518== by 0x420BCEC:
> > RTT::TaskContext::setActivity(RTT::base::ActivityInterface*)
> > (TaskContext.cpp:351)
> > ==18518== by 0x44B42FA:
> OCL::DeploymentComponent::setActivity(std::string
> > const&, double, int, int) (DeploymentComponent.cpp:1661)
> > ==18518== by 0x44CEA38:
> >
> boost::detail::function::function_obj_invoker4<boost::_bi::bind_t<boost::_bi::unspecified,
> > boost::_mfi::mf4<bool, OCL::DeploymentComponent, std::string const&,
> double,
> > int, int>,
> boost::_bi::list5<boost::_bi::value<OCL::DeploymentComponent*>,
> > boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4> > >, bool,
> > std::string const&, double, int,
> > int>::invoke(boost::detail::function::function_buffer&, std::string
> const&,
> > double, int, int) (mem_fn_template.hpp:506)
> > ==18518== by 0x44F54CC: RTT::internal::InvokerImpl<4, bool
> ()(std::string
> > const&, double, int, int), RTT::internal::LocalOperationCallerImpl<bool
> > ()(std::string const&, double, int, int)> >::call(std::string const&,
> > double, int, int) (function_template.hpp:1013)
> > ==18518==
>
> So it's saying you're trying to access a pointer in SlaveActivity
> which was freed before by setActivity. You should first set your
> master activity and then your slave activity, not the other way
> around.
>

Is there any way to check this from rtt ? Even if it's quite logical in the
end, it's quite error prone.
Something like mmaster->getActivity() (presently, it doesn't exists in
ActivityInterface) in SlaveActivity.

>
> Are you using a deployment script ?
>

Yes, a quite complex lua script so I had a mix with the order. I confirm
that the reordering solved the problem.

Thanks a lot for this fast and precise support.

>
> Peter
>
> > pure virtual method called
> > terminate called without an active exception
> > ==18518== Thread 11:
> > ==18518== Invalid read of size 4
> > ==18518== at 0x42D38B0: RTT::extras::SlaveActivity::getPeriod() const
> > (SlaveActivity.cpp:69)
> > ==18518== by 0x4272E43: RTT::base::TaskCore::getPeriod() const
> > (TaskCore.cpp:274)
> > ==18518== by 0x10B748AA: arp_core::SimulatedRtc::updateHook() (in
> > /opt/ard/arp_core/lib/orocos/gnulinux/libarp_core-components-gnulinux.so)
> > ==18518== by 0x425B65F: RTT::ExecutionEngine::processChildren()
> > (ExecutionEngine.cpp:331)
> > ==18518== by 0x425B5E0: RTT::ExecutionEngine::step()
> > (ExecutionEngine.cpp:321)
> > ==18518== by 0x4281145: RTT::base::RunnableInterface::loop()
> > (CoreRunnableInterface.cpp:60)
> > ==18518== by 0x42D3CCE: RTT::extras::SlaveActivity::execute()
> > (SlaveActivity.cpp:194)
> > ==18518== by 0x427230F: RTT::base::TaskCore::update()
> (TaskCore.cpp:93)
> > ==18518== by 0x109E3208: FBSched::updateHook() (fbsched.cpp:91)
> > ==18518== by 0x10B37E49: arp_core::PeriodicScheduler::updateHook() (in
> > /opt/ard/arp_core/lib/orocos/gnulinux/libarp_core-components-gnulinux.so)
> > ==18518== by 0x425B65F: RTT::ExecutionEngine::processChildren()
> > (ExecutionEngine.cpp:331)
> > ==18518== by 0x425B5E0: RTT::ExecutionEngine::step()
> > (ExecutionEngine.cpp:321)
> > ==18518== Address 0x9763918 is 0 bytes inside a block of size 148 free'd
> > ==18518== at 0x4024881: operator delete(void*)
> (vg_replace_malloc.c:387)
> > ==18518== by 0x41F186F: RTT::Activity::~Activity() (Activity.cpp:83)
> > ==18518== by 0x4210D2D: void
> > boost::checked_delete<RTT::Activity>(RTT::Activity*)
> (checked_delete.hpp:34)
> > ==18518== by 0x422B331:
> > boost::detail::sp_counted_impl_p<RTT::Activity>::dispose()
> > (sp_counted_impl.hpp:78)
> > ==18518== by 0x41E4A1B: boost::detail::sp_counted_base::release()
> > (sp_counted_base_gcc_x86.hpp:145)
> > ==18518== by 0x41E4A9F: boost::detail::shared_count::~shared_count()
> > (shared_count.hpp:217)
> > ==18518== by 0x420CC67:
> > boost::shared_ptr<RTT::base::ActivityInterface>::~shared_ptr()
> > (shared_ptr.hpp:169)
> > ==18518== by 0x420E0AF:
> >
> boost::shared_ptr<RTT::base::ActivityInterface>::operator=(boost::shared_ptr<RTT::base::ActivityInterface>
> > const&) (shared_ptr.hpp:305)
> > ==18518== by 0x420BCEC:
> > RTT::TaskContext::setActivity(RTT::base::ActivityInterface*)
> > (TaskContext.cpp:351)
> > ==18518== by 0x44B42FA:
> OCL::DeploymentComponent::setActivity(std::string
> > const&, double, int, int) (DeploymentComponent.cpp:1661)
> > ==18518== by 0x44CEA38:
> >
> boost::detail::function::function_obj_invoker4<boost::_bi::bind_t<boost::_bi::unspecified,
> > boost::_mfi::mf4<bool, OCL::DeploymentComponent, std::string const&,
> double,
> > int, int>,
> boost::_bi::list5<boost::_bi::value<OCL::DeploymentComponent*>,
> > boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4> > >, bool,
> > std::string const&, double, int,
> > int>::invoke(boost::detail::function::function_buffer&, std::string
> const&,
> > double, int, int) (mem_fn_template.hpp:506)
> > ==18518== by 0x44F54CC: RTT::internal::InvokerImpl<4, bool
> ()(std::string
> > const&, double, int, int), RTT::internal::LocalOperationCallerImpl<bool
> > ()(std::string const&, double, int, int)> >::call(std::string const&,
> > double, int, int) (function_template.hpp:1013)
> > ==18518==
> > pure virtual method called
> > ==18518== Thread 25:
> > ==18518== Invalid free() / delete / delete[]
> > ==18518== at 0x4024B6A: free (vg_replace_malloc.c:366)
> > ==18518== by 0x55E3623: free_mem (in /lib/i686/cmov/libc-2.11.3.so)
> > ==18518== by 0x55E30E9: __libc_freeres (in /lib/i686/cmov/
> libc-2.11.3.so)
> > ==18518== by 0x401F4D3: _vgnU_freeres (vg_preloaded.c:62)
> > ==18518== by 0xDF1E44F: ???
> > ==18518== by 0x42712A1: RTT::os::rtos_task_wait_period(RTOS_TASK*)
> > (fosi_internal.cpp:212)
> > ==18518== by 0x4268FBC: RTT::os::thread_function(void*)
> (Thread.cpp:161)
> > ==18518== by 0x4761954: start_thread (pthread_create.c:300)
> > ==18518== by 0x55A25ED: clone (clone.S:130)
> > ==18518== Address 0x54b7a10 is not stack'd, malloc'd or (recently)
> free'd
> >
> >
>

Segfault when playing with MasterSlave activities

I'm on a 2.5 version, sorry I forgot to preicse the first time.

2014-05-02 20:48 GMT+02:00 Willy Lambert <lambert [dot] willy [..] ...>:

> Here is a second trace. The problem happens independantly of master's
> state. I have the problem each time I try to start a Slave
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
> (gdb) bt
> #0 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
> #1 0xb7f3cc54 in RTT::extras::SlaveActivity::trigger (this=0xaa3e7030)
> at
> /opt/ros_addons/orocos_toolchain/rtt/rtt/extras/SlaveActivity.cpp:182
> #2 0xb7edb36a in RTT::base::TaskCore::trigger (this=0xaa3de990)
> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:100
> #3 0xb7edb99d in RTT::base::TaskCore::start (this=0xaa3de990)
> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:198
> #4 0xb7e74f1c in RTT::TaskContext::start (this=0xaa3de990)
> at /opt/ros_addons/orocos_toolchain/rtt/rtt/TaskContext.cpp:399
> #5 0xb7e8f355 in boost::_mfi::mf0<bool, RTT::TaskContext>::operator()
> (this=0x9c92a744,
> p=0xaa3de990) at /usr/include/boost/bind/mem_fn_template.hpp:49
>
> I have rebuilt quite a lot of my packages to be sure it is not a
> compilation issue, but I'm not really sure that I can't have forgottent
> something.
>
>
>
> 2014-05-02 17:37 GMT+02:00 Willy Lambert <lambert [dot] willy [..] ...>:
>
> Hi all,
>>
>> I have a very strange segfault that appens when I'm starting a Slave
>> Component.
>>
>> For information, the master component is not started yet (it's maybe a
>> bad use, but it shouldn't segfault).
>>
>> In short the problem is here :
>> #0 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
>> #1 0xb7f3cc54 in RTT::extras::SlaveActivity::trigger (this=0xaabdadc0)
>> at
>> /opt/ros_addons/orocos_toolchain/rtt/rtt/extras/SlaveActivity.cpp:182
>> #2 0xb7edb36a in RTT::base::TaskCore::trigger (this=0xaabea998)
>> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:100
>>
>> But the associated lines seems Ok (as the pointer is checked) :
>>
>> bool SlaveActivity::trigger()
>> {
>> if (mmaster)
>> return mmaster->trigger();
>> return false;
>> }
>>
>>
>>
>> Here is the first lines of stack when segfaulting :
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
>> (gdb) bt
>> #0 0x08061588 in vtable for __cxxabiv1::__si_class_type_info ()
>> #1 0xb7f3cc54 in RTT::extras::SlaveActivity::trigger (this=0xaabdadc0)
>> at
>> /opt/ros_addons/orocos_toolchain/rtt/rtt/extras/SlaveActivity.cpp:182
>> #2 0xb7edb36a in RTT::base::TaskCore::trigger (this=0xaabea998)
>> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:100
>> #3 0xb7edb99d in RTT::base::TaskCore::start (this=0xaabea998)
>> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:198
>> #4 0xb7e74f1c in RTT::TaskContext::start (this=0xaabea998)
>> at /opt/ros_addons/orocos_toolchain/rtt/rtt/TaskContext.cpp:399
>> #5 0xb7e8f355 in boost::_mfi::mf0<bool, RTT::TaskContext>::operator()
>> (this=0x9ecc20cc,
>> p=0xaabea998) at /usr/include/boost/bind/mem_fn_template.hpp:49
>> #6 0xb7e8e8f6 in boost::_bi::list1<boost::_bi::value<RTT::TaskContext*>
>> >::operator()<bool, boost::_mfi::mf0<bool, RTT::TaskContext>,
>> boost::_bi::list0> (this=0x9ecc20d4, f=..., a=...)
>> at /usr/include/boost/bind/bind.hpp:243
>> #7 0xb7e8e0d2 in boost::_bi::bind_t<boost::_bi::unspecified,
>> boost::_mfi::mf0<bool, RTT::TaskContext>,
>> boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >::operator()
>> (this=0x9ecc20cc)
>> at /usr/include/boost/bind/bind_template.hpp:20
>> #8 0xb7e8d7a0 in
>> boost::detail::function::function_obj_invoker0<boost::_bi::bind_t<boost::_bi::unspecified,
>> boost::_mfi::mf0<bool, RTT::TaskContext>,
>> boost::_bi::list1<boost::_bi::value<RTT::TaskContext*> > >, bool>::invoke
>> (function_obj_ptr=...)
>> at /usr/include/boost/function/function_template.hpp:132
>> #9 0xb7ea4359 in boost::function0<bool>::operator() (this=0x9ecc20c8)
>> at /usr/include/boost/function/function_template.hpp:1013
>> #10 0xb7e9e377 in RTT::internal::LocalOperationCallerImpl<bool
>> ()()>::call_impl() (
>> this=0x9ecc20b8)
>> at
>> /opt/ros_addons/orocos_toolchain/rtt/rtt/internal/../internal/LocalOperationCaller.hpp:335
>> #11 0xb7e981ab in RTT::internal::InvokerImpl<0, bool ()(),
>> RTT::internal::LocalOperationCallerImpl<bool ()()> >::call()
>> (this=0x9ecc20b8)
>> at
>> /opt/ros_addons/orocos_toolchain/rtt/rtt/internal/../internal/Invoker.hpp:75
>> #12 0xad4c87c9 in arp_core::Monitor::startHook() ()
>> from
>> /opt/ard/arp_core/lib/orocos/gnulinux/libarp_core-components-gnulinux.so
>> #13 0xb7edb97d in RTT::base::TaskCore::start (this=0xaabe2dc8)
>> at /opt/ros_addons/orocos_toolchain/rtt/rtt/base/TaskCore.cpp:196
>> #14 0xb7e74f1c in RTT::TaskContext::start (this=0xaabe2dc8)
>> at /opt/ros_addons/orocos_toolchain/rtt/rtt/TaskContext.cpp:399
>> #15 0xb7e8f355 in boost::_mfi::mf0<bool, RTT::TaskContext>::operator()
>> (this=0x9ecc1fdc,
>> p=0xaabe2dc8) at /usr/include/boost/bind/mem_fn_template.hpp:49
>> #16 0xb7e8e8f6 in boost::_bi::list1<boost::_bi::value<RTT::TaskContext*>
>> >::operator()<bool, boost::_mfi::mf0<bool, RTT::TaskContext>,
>> boost::_bi::list0> (this=0x9ecc1fe4, f=..., a=...)
>> at /usr/include/boost/bind/bind.hpp:243
>>
>>
>