Segfault in the RTT Lua example

Hi,

I am facing a Segmentation Fault when loading my Lua scripts.
I have reproduced it with the 'ping/pong' example which is in the
LuaCookbook (section 9.2).

The segfault appears when executing the launch_fsm.lua script (line 10 in
deploy.lua)

The gdb backtrace is:

OROCOS RTTLua 1.0-beta5 / Lua 5.1.4 (gnulinux)
[New Thread 0xb572fb70 (LWP 5306)]

Program received signal SIGSEGV, Segmentation fault.
0x00512d87 in pthread_mutex_lock () from /lib/i386-linux-gnu/libpthread.so.0
(gdb) bt
#0 0x00512d87 in pthread_mutex_lock () from
/lib/i386-linux-gnu/libpthread.so.0
#1 0x00228c37 in rtos_mutex_lock (m=<optimized out>)
at /home/lesire/work/autoproj/rtt/rtt/os/tlsf/../gnulinux/fosi.h:238
#2 oro_rt_malloc (size=96) at
/home/lesire/work/autoproj/rtt/rtt/os/tlsf/tlsf.c:632
#3 0x08071c7d in allocate (n=1, this=<optimized out>)
at
/home/lesire/work/autoproj/install/include/rtt/internal/../internal/../os/oro_allocator.hpp:276
#4 shared_count<RTT::internal::LocalOperationCaller std::basic_string boost::detail::sp_ms_deleter<RTT::internal::LocalOperationCaller std::basic_string RTT::os::rt_allocator<RTT::internal::LocalOperationCaller std::basic_string a=<optimized out>, d=access outside bounds of object referenced via
synthetic pointer
) at /usr/include/boost/smart_ptr/detail/shared_count.hpp:159
#5 shared_ptr<RTT::internal::LocalOperationCaller std::basic_string boost::detail::sp_ms_deleter<RTT::internal::LocalOperationCaller std::basic_string RTT::os::rt_allocator<RTT::internal::LocalOperationCaller std::basic_string of object referenced via synthetic pointer
)
at /usr/include/boost/smart_ptr/shared_ptr.hpp:205
#6 boost::allocate_shared<RTT::internal::LocalOperationCaller (std::string const&)>,
RTT::os::rt_allocator<RTT::internal::LocalOperationCaller const&)> >, RTT::internal::LocalOperationCaller<bool (std::string const&)>
>(RTT::os::rt_allocator<RTT::internal::LocalOperationCaller (std::string const&)> > const&, RTT::internal::LocalOperationCaller<bool
(std::string const&)> const&) (a=..., a1=...)
at /usr/include/boost/smart_ptr/make_shared.hpp:201
#7 0x08071f9f in RTT::internal::LocalOperationCaller<bool (std::string
const&)>::cloneRT() const (
this=0x810d498)
at
/home/lesire/work/autoproj/install/include/rtt/internal/../internal/LocalOperationCaller.hpp:720#8
0x080719fe in RTT::internal::LocalOperationCallerImpl<bool(const
std::basic_string <return> to quit---
char>, std::allocator<char> >&)>::send_impl<std::basic_string const&>(const std::basic_string<char, std::char_traits std::allocator<char> > &) (this=0x810d498, a1=...)
at
/home/lesire/work/autoproj/install/include/rtt/internal/../internal/LocalOperationCaller.hpp:189
#9 0x08073560 in call_impl<std::basic_string out>, this=<optimized out>)
at
/home/lesire/work/autoproj/install/include/rtt/internal/../internal/LocalOperationCaller.hpp:377
#10 RTT::internal::InvokerImpl<1, bool (std::string const&),
RTT::internal::LocalOperationCallerImpl<bool (std::string const&)>
>::call(std::string const&) (this=0x4, a1=...)
at
/home/lesire/work/autoproj/install/include/rtt/internal/../internal/Invoker.hpp:96
#11 0x08074f66 in operator()<bool, bool (*)(bool
(RTT::base::OperationCallerBase std::basic_string boost::fusion::cons<RTT::base::OperationCallerBase std::basic_string std::basic_string (this=0xbfffdcbc, f=<optimized out>, a=<optimized out>)
at /usr/include/boost/bind/bind.hpp:303
#12 operator() (this=0xbfffdcb8) at
/usr/include/boost/bind/bind_template.hpp:20
#13 exec<boost::_bi::bind_t (RTT::base::OperationCallerBase std::basic_string boost::fusion::cons<RTT::base::OperationCallerBase std::basic_string std::basic_string boost::_bi::list2<boost::_bi::value bool(const std::basic_string boost::_bi::value<boost::fusion::cons std::basic_string std::basic_string bounds of object referenced via synthetic pointer
) at
/home/lesire/work/autoproj/install/include/rtt/internal/BindStorage.hpp:135
#14 RTT::internal::FusedMCallDataSource<bool (std::string
const&)>::evaluate() const (this=0x810d500)
at
/home/lesire/work/autoproj/install/include/rtt/internal/FusedFunctorDataSource.hpp:298
#15 0x001e49b9 in RTT::internal::AssignCommand<bool, bool>::readArguments
(this=0x810d448)
at /home/lesire/work/autoproj/rtt/rtt/internal/AssignCommand.hpp:80
#16 0x00258d33 in RTT::internal::DataSourceCommand::get (this=0x810d460)
at /home/lesire/work/autoproj/rtt/rtt/internal/DataSourceCommand.cpp:62
#17 0x0806abff in RTT::internal::DataSource<bool>::evaluate (this=0x810d460)
at
/home/lesire/work/autoproj/install/include/rtt/internal/DataSource.inl:54
#18 0x00246771 in RTT::internal::OperationCallerC::call (this=0x810d0f8)
at /home/lesire/work/autoproj/rtt/rtt/internal/OperationCallerC.cpp:214
#19 0x08066d9b in __Operation_call (L=0x808ffe8) at
/home/lesire/work/autoproj/ocl/lua/rtt.cpp:1393
#20 Operation_call (L=0x808ffe8) at
/home/lesire/work/autoproj/ocl/lua/rtt.cpp:1439
#21 0x004819ce in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#22 0x0048c93b in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#23 0x00481de8 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#24 0x0047c180 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#25 0x0048109e in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#26 0x00481fc0 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#27 0x0047d763 in lua_pcall () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#28 0x08075ea6 in docall (L=0x808ffe8, narg=0, clear=0) at
/home/lesire/work/autoproj/ocl/lua/lua-repl.c:112
#29 0x08076996 in handle_script (n=<optimized out>, argv=<optimized out>,
L=<optimized out>)
at /home/lesire/work/autoproj/ocl/lua/lua-repl.c:260
#30 pmain (L=0x808ffe8) at /home/lesire/work/autoproj/ocl/lua/lua-repl.c:372
#31 0x004819ce in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#32 0x00481d8b in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#33 0x0047c148 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#34 0x0048109e in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#35 0x00481fc0 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#36 0x0047d7ef in lua_cpcall () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#37 0x08076a91 in main_args (L=0x808ffe8, argc=3, argv=0xbfffe724)
at /home/lesire/work/autoproj/ocl/lua/lua-repl.c:411
#38 0x0806a3c8 in lua_repl (argv=0xbfffe724, argc=3, this=0xbfffe568)
at /home/lesire/work/autoproj/ocl/lua/LuaComponent.cpp:192
#39 ORO_main_impl (argc=3, argv=0xbfffe724) at
/home/lesire/work/autoproj/ocl/lua/LuaComponent.cpp:266
#40 0x0805d84e in main (argc=3, argv=0xbfffe724) at
/home/lesire/work/autoproj/ocl/lua/LuaComponent.cpp:247

Segfault in the RTT Lua example

2012/4/5 Charles Lesire-Cabaniols <charles [dot] lesire [..] ...>

> Hi,
>
> I am facing a Segmentation Fault when loading my Lua scripts.
> I have reproduced it with the 'ping/pong' example which is in the
> LuaCookbook (section 9.2).
>
> The segfault appears when executing the launch_fsm.lua script (line 10 in
> deploy.lua)
>

The example works when launched with the deployer-gnulinux...

>
> The gdb backtrace is:
>
> OROCOS RTTLua 1.0-beta5 / Lua 5.1.4 (gnulinux)
> [New Thread 0xb572fb70 (LWP 5306)]
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00512d87 in pthread_mutex_lock () from
> /lib/i386-linux-gnu/libpthread.so.0
> (gdb) bt
> #0 0x00512d87 in pthread_mutex_lock () from
> /lib/i386-linux-gnu/libpthread.so.0
> #1 0x00228c37 in rtos_mutex_lock (m=<optimized out>)
> at /home/lesire/work/autoproj/rtt/rtt/os/tlsf/../gnulinux/fosi.h:238
> #2 oro_rt_malloc (size=96) at
> /home/lesire/work/autoproj/rtt/rtt/os/tlsf/tlsf.c:632
> #3 0x08071c7d in allocate (n=1, this=<optimized out>)
> at
> /home/lesire/work/autoproj/install/include/rtt/internal/../internal/../os/oro_allocator.hpp:276
> #4 shared_count<RTT::internal::LocalOperationCaller > std::basic_string<char>&)>*,
> boost::detail::sp_ms_deleter<RTT::internal::LocalOperationCaller > std::basic_string<char>&)> >,
> RTT::os::rt_allocator<RTT::internal::LocalOperationCaller > std::basic_string<char>&)> > > (this=0xbfffdaf0,
> a=<optimized out>, d=access outside bounds of object referenced via
> synthetic pointer
> ) at /usr/include/boost/smart_ptr/detail/shared_count.hpp:159
> #5 shared_ptr<RTT::internal::LocalOperationCaller > std::basic_string<char>&)>,
> boost::detail::sp_ms_deleter<RTT::internal::LocalOperationCaller > std::basic_string<char>&)> >,
> RTT::os::rt_allocator<RTT::internal::LocalOperationCaller > std::basic_string<char>&)> > > (a=<optimized out>, d=access outside bounds
> of object referenced via synthetic pointer
> )
> at /usr/include/boost/smart_ptr/shared_ptr.hpp:205
> #6 boost::allocate_shared<RTT::internal::LocalOperationCaller > (std::string const&)>,
> RTT::os::rt_allocator<RTT::internal::LocalOperationCaller > const&)> >, RTT::internal::LocalOperationCaller<bool (std::string const&)>
> >(RTT::os::rt_allocator<RTT::internal::LocalOperationCaller > (std::string const&)> > const&, RTT::internal::LocalOperationCaller<bool
> (std::string const&)> const&) (a=..., a1=...)
> at /usr/include/boost/smart_ptr/make_shared.hpp:201
> #7 0x08071f9f in RTT::internal::LocalOperationCaller<bool (std::string
> const&)>::cloneRT() const (
> this=0x810d498)
> at
> /home/lesire/work/autoproj/install/include/rtt/internal/../internal/LocalOperationCaller.hpp:720#8
> 0x080719fe in RTT::internal::LocalOperationCallerImpl<bool(const
> std::basic_string<char, std::char_traits<---Type > <return> to quit---
> char>, std::allocator<char> >&)>::send_impl<std::basic_string > const&>(const std::basic_string<char, std::char_traits > std::allocator<char> > &) (this=0x810d498, a1=...)
> at
> /home/lesire/work/autoproj/install/include/rtt/internal/../internal/LocalOperationCaller.hpp:189
> #9 0x08073560 in call_impl<std::basic_string > out>, this=<optimized out>)
> at
> /home/lesire/work/autoproj/install/include/rtt/internal/../internal/LocalOperationCaller.hpp:377
> #10 RTT::internal::InvokerImpl<1, bool (std::string const&),
> RTT::internal::LocalOperationCallerImpl<bool (std::string const&)>
> >::call(std::string const&) (this=0x4, a1=...)
> at
> /home/lesire/work/autoproj/install/include/rtt/internal/../internal/Invoker.hpp:96
> #11 0x08074f66 in operator()<bool, bool (*)(bool
> (RTT::base::OperationCallerBase<bool(const
> std::basic_string<char>&)>::*)(const std::basic_string<char>&), const
> boost::fusion::cons<RTT::base::OperationCallerBase > std::basic_string<char>&)>*, boost::fusion::cons<const
> std::basic_string<char>&, boost::fusion::nil> >&), boost::_bi::list0>
> (this=0xbfffdcbc, f=<optimized out>, a=<optimized out>)
> at /usr/include/boost/bind/bind.hpp:303
> #12 operator() (this=0xbfffdcb8) at
> /usr/include/boost/bind/bind_template.hpp:20
> #13 exec<boost::_bi::bind_t > (RTT::base::OperationCallerBase<bool(const
> std::basic_string<char>&)>::*)(const std::basic_string<char>&), const
> boost::fusion::cons<RTT::base::OperationCallerBase > std::basic_string<char>&)>*, boost::fusion::cons<const
> std::basic_string<char>&, boost::fusion::nil> >&),
> boost::_bi::list2<boost::_bi::value > bool(const std::basic_string<char>&)>::*)(const std::basic_string<char>&)>,
> boost::_bi::value<boost::fusion::cons > std::basic_string<char>&)>*, boost::fusion::cons<const
> std::basic_string<char>&, boost::fusion::nil> > > > > > (f=access outside
> bounds of object referenced via synthetic pointer
> ) at
> /home/lesire/work/autoproj/install/include/rtt/internal/BindStorage.hpp:135
> #14 RTT::internal::FusedMCallDataSource<bool (std::string
> const&)>::evaluate() const (this=0x810d500)
> at
> /home/lesire/work/autoproj/install/include/rtt/internal/FusedFunctorDataSource.hpp:298
> #15 0x001e49b9 in RTT::internal::AssignCommand<bool, bool>::readArguments
> (this=0x810d448)
> at /home/lesire/work/autoproj/rtt/rtt/internal/AssignCommand.hpp:80
> #16 0x00258d33 in RTT::internal::DataSourceCommand::get (this=0x810d460)
> at /home/lesire/work/autoproj/rtt/rtt/internal/DataSourceCommand.cpp:62
> #17 0x0806abff in RTT::internal::DataSource<bool>::evaluate
> (this=0x810d460)
> at
> /home/lesire/work/autoproj/install/include/rtt/internal/DataSource.inl:54
> #18 0x00246771 in RTT::internal::OperationCallerC::call (this=0x810d0f8)
> at /home/lesire/work/autoproj/rtt/rtt/internal/OperationCallerC.cpp:214
> #19 0x08066d9b in __Operation_call (L=0x808ffe8) at
> /home/lesire/work/autoproj/ocl/lua/rtt.cpp:1393
> #20 Operation_call (L=0x808ffe8) at
> /home/lesire/work/autoproj/ocl/lua/rtt.cpp:1439
> #21 0x004819ce in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
> #22 0x0048c93b in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
> #23 0x00481de8 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
> #24 0x0047c180 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
> #25 0x0048109e in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
> #26 0x00481fc0 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
> #27 0x0047d763 in lua_pcall () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
> #28 0x08075ea6 in docall (L=0x808ffe8, narg=0, clear=0) at
> /home/lesire/work/autoproj/ocl/lua/lua-repl.c:112
> #29 0x08076996 in handle_script (n=<optimized out>, argv=<optimized out>,
> L=<optimized out>)
> at /home/lesire/work/autoproj/ocl/lua/lua-repl.c:260
> #30 pmain (L=0x808ffe8) at
> /home/lesire/work/autoproj/ocl/lua/lua-repl.c:372
> #31 0x004819ce in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
> #32 0x00481d8b in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
> #33 0x0047c148 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
> #34 0x0048109e in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
> #35 0x00481fc0 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
> #36 0x0047d7ef in lua_cpcall () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
> #37 0x08076a91 in main_args (L=0x808ffe8, argc=3, argv=0xbfffe724)
> at /home/lesire/work/autoproj/ocl/lua/lua-repl.c:411
> #38 0x0806a3c8 in lua_repl (argv=0xbfffe724, argc=3, this=0xbfffe568)
> at /home/lesire/work/autoproj/ocl/lua/LuaComponent.cpp:192
> #39 ORO_main_impl (argc=3, argv=0xbfffe724) at
> /home/lesire/work/autoproj/ocl/lua/LuaComponent.cpp:266
> #40 0x0805d84e in main (argc=3, argv=0xbfffe724) at
> /home/lesire/work/autoproj/ocl/lua/LuaComponent.cpp:247
>
>

Segfault in the RTT Lua example

Hi Charles,

On Thu, Apr 05, 2012 at 08:54:21AM +0200, Charles Lesire-Cabaniols wrote:
>
>
> 2012/4/5 Charles Lesire-Cabaniols <charles [dot] lesire [..] ...>
>
> Hi,
>
> I am facing a Segmentation Fault when loading my Lua scripts.
> I have reproduced it with the 'ping/pong' example which is in the
> LuaCookbook (section 9.2).
>
> The segfault appears when executing the launch_fsm.lua script (line 10 in
> deploy.lua)
>
> The example works when launched with the deployer-gnulinux...

I can't reproduce the crash neither on 32 or 64. Its failing deep down
in RTT, maybe something is not properly compiled? It seems at times
that rttlua puts more stress on RTT internals than orocos scripts.

Markus

Segfault in the RTT Lua example

2012/4/5 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>

> Hi Charles,
>
> On Thu, Apr 05, 2012 at 08:54:21AM +0200, Charles Lesire-Cabaniols wrote:
> >
> >
> > 2012/4/5 Charles Lesire-Cabaniols <charles [dot] lesire [..] ...>
> >
> > Hi,
> >
> > I am facing a Segmentation Fault when loading my Lua scripts.
> > I have reproduced it with the 'ping/pong' example which is in the
> > LuaCookbook (section 9.2).
> >
> > The segfault appears when executing the launch_fsm.lua script (line
> 10 in
> > deploy.lua)
> >
> > The example works when launched with the deployer-gnulinux...
>
> I can't reproduce the crash neither on 32 or 64. Its failing deep down
> in RTT, maybe something is not properly compiled? It seems at times
> that rttlua puts more stress on RTT internals than orocos scripts.
>

Effectively, it works after recompiling all my component libraries...

>
> Markus
>