luabind exceptions from 0.7 towards 0.8.1

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

luabind exceptions from 0.7 towards 0.8.1

Andreas Grob-3
Hi all!

Currently I am trying to upgrade our server from luabind-0.7/lua-5.0 to
luabind-0.8.1 / lua-5.1.4. After the upgrade, luabind seems to crash the
server, when a bad script is called. Was there any change in exception
handling? Do I have to set compile time options? Anything is working just
fine with the previous version. This is the reproducable gdb stacktrace.
Perhaps you can easily spot what is going wrong there.

Thank you in advance,

Andreas


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb76ed6d0 (LWP 2616)]
0x080820a4 in __gnu_cxx::hashtable<std::pair<MAP_POSITION const,
std::map<unsigned char, CContainer*, std::less<unsigned char>,
std::allocator<std::pair<unsigned char const, CContainer*> > > >,
MAP_POSITION, CMap::mapposhash, std::_Select1st<std::pair<MAP_POSITION
const, std::map<unsigned char, CContainer*, std::less<unsigned char>,
std::allocator<std::pair<unsigned char const, CContainer*> > > > >,
CMap::eqmappos, std::allocator<std::map<unsigned char, CContainer*,
std::less<unsigned char>, std::allocator<std::pair<unsigned char const,
CContainer*> > > > >::clear (this=0x1a79d6f8)
    at /usr/include/c++/4.3/backward/hashtable.h:1081
1081          _Node* __cur = _M_buckets[__i];
(gdb) backtrace
#0  0x080820a4 in __gnu_cxx::hashtable<std::pair<MAP_POSITION const,
std::map<unsigned char, CContainer*, std::less<unsigned char>,
std::allocator<std::pair<unsigned char const, CContainer*> > > >,
MAP_POSITION, CMap::mapposhash, std::_Select1st<std::pair<MAP_POSITION
const, std::map<unsigned char, CContainer*, std::less<unsigned char>,
std::allocator<std::pair<unsigned char const, CContainer*> > > > >,
CMap::eqmappos, std::allocator<std::map<unsigned char, CContainer*,
std::less<unsigned char>, std::allocator<std::pair<unsigned char const,
CContainer*> > > > >::clear (this=0x1a79d6f8)
    at /usr/include/c++/4.3/backward/hashtable.h:1081
#1  0x08082235 in ~hashtable (this=0x1a79d6f8) at
/usr/include/c++/4.3/backward/hashtable.h:360
#2  0x080822c1 in ~hash_map (this=0x1a79d6f8) at
/usr/include/c++/4.3/ext/hash_map:84
#3  0x0808050a in ~CMap (this=0x1a79d6f8) at CMap.cpp:69
#4  0x080ab061 in ~CWorld (this=0xbfb0c1a4) at CWorld.cpp:463
#5  0x0825bf90 in luabind::detail::out_value_converter<524,
luabind::detail::null_type>::converter_postcall<CWorld> (this=0xbfb0c1a4,
L=0x1c641120) at /opt/include/luabind/out_value_policy.hpp:109
#6  0x08262eaa in luabind::detail::invoke_member<luabind::adl::object
(CWorld::*)(position, unsigned char),
boost::mpl::vector4<luabind::adl::object, CWorld&, position, unsigned
char>, luabind::detail::policy_cons<luabind::detail::out_value_policy<1,
luabind::detail::null_type>, luabind::detail::null_type> > (L=0x1c641120,
f=@0x1c65d228)
    at
/opt/include/boost-1_39/boost/preprocessor/iteration/detail/local.hpp:34
#7  0x08263015 in luabind::detail::invoke0<luabind::adl::object
(CWorld::*)(position, unsigned char),
boost::mpl::vector4<luabind::adl::object, CWorld&, position, unsigned
char>, luabind::detail::policy_cons<luabind::detail::out_value_policy<1,
luabind::detail::null_type>, luabind::detail::null_type>,
boost::is_void<luabind::adl::object> > (L=0x1c641120, f=@0x1c65d228,
policies=@0xbfb0c527)
    at /opt/include/luabind/detail/call.hpp:37
#8  0x0826304e in luabind::detail::invoke<luabind::adl::object
(CWorld::*)(position, unsigned char),
boost::mpl::vector4<luabind::adl::object, CWorld&, position, unsigned
char>, luabind::detail::policy_cons<luabind::detail::out_value_policy<1,
luabind::detail::null_type>, luabind::detail::null_type> > (L=0x1c641120,
f=@0x1c65d228, policies=@0xbfb0c527) at
/opt/include/luabind/detail/call.hpp:58
#9  0x08263077 in luabind::detail::function_invoke<luabind::adl::object
(CWorld::*)(position, unsigned char),
boost::mpl::vector4<luabind::adl::object, CWorld&, position, unsigned
char>, luabind::detail::policy_cons<luabind::detail::out_value_policy<1,
luabind::detail::null_type>, luabind::detail::null_type> >::operator()
(this=0x1c65d228, L=0x1c641120) at
/opt/include/luabind/make_function.hpp:31
#10 0x08263097 in
boost::detail::function::function_obj_invoker1<luabind::detail::function_invoke<luabind::adl::object
(CWorld::*)(position, unsigned char),
boost::mpl::vector4<luabind::adl::object, CWorld&, position, unsigned
char>, luabind::detail::policy_cons<luabind::detail::out_value_policy<1,
luabind::detail::null_type>, luabind::detail::null_type> >, int,
lua_State*>::invoke (
    function_obj_ptr=@0x1c65d228, a0=0x1c641120) at
/opt/include/boost-1_39/boost/function/function_template.hpp:131
#11 0xb7c90c0b in boost::function1<int, lua_State*>::operator()
(this=0x1c65d224, a0=0x1c641120) at
/home/vilarion/boost_1_39_0/boost/function/function_template.hpp:989
#12 0xb7c9240c in call (this=0x1c65d21c, L=0x1c641120) at
src/function.cpp:114
#13 0xb7c9167f in call<const luabind::detail::<unnamed>::function* const,
lua_State*> (this=0xbfb0c6f8, u=@0xbfb0c700, b1=@0xbfb0c650) at
/home/vilarion/boost_1_39_0/boost/bind/mem_fn_template.hpp:217
#14 0xb7c916a8 in operator()<const luabind::detail::<unnamed>::function*>
(this=0xbfb0c6f8, u=@0xbfb0c700, a1=0x1c641120) at
/home/vilarion/boost_1_39_0/boost/bind/mem_fn_template.hpp:226
#15 0xb7c916ff in operator()<int, boost::_mfi::cmf1<int,
luabind::detail::<unnamed>::function, lua_State*>, boost::_bi::list0>
(this=0xbfb0c700, f=@0xbfb0c6f8, a=@0xbfb0c6a3)
    at /home/vilarion/boost_1_39_0/boost/bind/bind.hpp:296
#16 0xb7c9174e in operator() (this=0xbfb0c6f8) at
/home/vilarion/boost_1_39_0/boost/bind/bind_template.hpp:20
#17 0xb7c9185b in handle_exceptions<int, boost::_bi::bind_t<int,
boost::_mfi::cmf1<int, luabind::detail::<unnamed>::function, lua_State*>,
boost::_bi::list2<boost::_bi::value<const
luabind::detail::<unnamed>::function*>, boost::_bi::value<lua_State*> > >
> (L=0x1c641120, fn=
            {f_ = {f_ = 0xb7c921bc <call>}, l_ =
{<boost::_bi::storage2<boost::_bi::value<const
luabind::detail::<unnamed>::function*>,
boost::_bi::value<lua_State*> >> =
{<boost::_bi::storage1<boost::_bi::value<const
luabind::detail::<unnamed>::function*> >> = {a1_ = {t_ =
0x1c65d21c}}, a2_ = {t_ = 0x1c641120}}, <No data fields>}}) at
./luabind/exception_handler.hpp:94
#18 0xb7c92161 in function_dispatcher (L=0x1c641120) at src/function.cpp:125
#19 0x082c2b05 in luaD_precall ()
#20 0x082cc040 in luaV_execute ()
#21 0x082c30a8 in luaD_call ()
#22 0x082c0181 in f_call ()
#23 0x082c26b7 in luaD_rawrunprotected ()
#24 0x082c271f in luaD_pcall ()
#25 0x082bff9b in lua_pcall ()
#26 0xb7c93ac7 in luabind::detail::pcall (L=0x1c641120, nargs=0,
nresults=0) at src/pcall.cpp:42
#27 0x08270aa4 in ~proxy_function_void_caller (this=0xbfb0ca5c) at
/opt/include/luabind/detail/call_function.hpp:262
#28 0x0826e60d in CLuaNPCScript::nextCycle (this=0x1c6223d0) at
script/CLuaNPCScript.cpp:25
#29 0x080a7605 in CWorld::checkNPC (this=0xa22c860) at CWorld.cpp:907
#30 0x080aae3f in CWorld::turntheworld (this=0xa22c860) at CWorld.cpp:509
#31 0x08135709 in main (argc=2, argv=0xbfb0d024) at main.cpp:211


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: luabind exceptions from 0.7 towards 0.8.1 (copied singleton)

Andreas Grob-3
Hello all,

when looking at the error more closely, I noticed, that the destructor
of CWorld is called, with CWorld being a singleton. The copy
constructors of CWorld were not private, but they should be. When I make
them private, the code does not compile any more, since luabind tries to
copy CWorld. What is the luabind 0.8.1 way of dealing with singletons?
This is what I did with luabind 0.7:

612: luabind::object globals = luabind::globals(_luaState);
613: globals["world"] = CWorld::get();

With CWorld::get() returning a pointer to the singleton and the copy
constructors private this results in:

./CWorld.hpp: In member function 'void
luabind::detail::value_converter::apply(lua_State*, const T&) [with T =
CWorld]':
/opt/include/luabind/object.hpp:67:   instantiated from 'void
luabind::detail::push_aux(lua_State*, T&, ConverterGenerator*) [with T =
const CWorld, ConverterGenerator = luabind::detail::push(lua_State*, T&,
const Policies&) [with T = const CWorld, Policies =
luabind::detail::null_type]::converter_policy]'
/opt/include/luabind/object.hpp:83:   instantiated from 'void
luabind::detail::push(lua_State*, T&, const Policies&) [with T = const
CWorld, Policies = luabind::detail::null_type]'
/opt/include/luabind/object.hpp:89:   instantiated from 'void
luabind::detail::push(lua_State*, T&) [with T = const CWorld]'
/opt/include/luabind/object.hpp:626:   instantiated from
'luabind::adl::index_proxy<Next>&
luabind::adl::index_proxy<Next>::operator=(const T&) [with T = CWorld,
Next = luabind::adl::object]'
script/CLuaScript.cpp:613:   instantiated from here
./CWorld.hpp:1694: error: 'CWorld::CWorld(const CWorld&)' is private

Is there a way to avoid copying singletons?

Best regards,
Andreas



Andreas Grob schrieb:

> Hi all!
>
> Currently I am trying to upgrade our server from luabind-0.7/lua-5.0 to
> luabind-0.8.1 / lua-5.1.4. After the upgrade, luabind seems to crash the
> server, when a bad script is called. Was there any change in exception
> handling? Do I have to set compile time options? Anything is working just
> fine with the previous version. This is the reproducable gdb stacktrace.
> Perhaps you can easily spot what is going wrong there.
>
> Thank you in advance,
>
> Andreas
>
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0xb76ed6d0 (LWP 2616)]
> 0x080820a4 in __gnu_cxx::hashtable<std::pair<MAP_POSITION const,
> std::map<unsigned char, CContainer*, std::less<unsigned char>,
> std::allocator<std::pair<unsigned char const, CContainer*> > > >,
> MAP_POSITION, CMap::mapposhash, std::_Select1st<std::pair<MAP_POSITION
> const, std::map<unsigned char, CContainer*, std::less<unsigned char>,
> std::allocator<std::pair<unsigned char const, CContainer*> > > > >,
> CMap::eqmappos, std::allocator<std::map<unsigned char, CContainer*,
> std::less<unsigned char>, std::allocator<std::pair<unsigned char const,
> CContainer*> > > > >::clear (this=0x1a79d6f8)
>     at /usr/include/c++/4.3/backward/hashtable.h:1081
> 1081          _Node* __cur = _M_buckets[__i];
> (gdb) backtrace
> #0  0x080820a4 in __gnu_cxx::hashtable<std::pair<MAP_POSITION const,
> std::map<unsigned char, CContainer*, std::less<unsigned char>,
> std::allocator<std::pair<unsigned char const, CContainer*> > > >,
> MAP_POSITION, CMap::mapposhash, std::_Select1st<std::pair<MAP_POSITION
> const, std::map<unsigned char, CContainer*, std::less<unsigned char>,
> std::allocator<std::pair<unsigned char const, CContainer*> > > > >,
> CMap::eqmappos, std::allocator<std::map<unsigned char, CContainer*,
> std::less<unsigned char>, std::allocator<std::pair<unsigned char const,
> CContainer*> > > > >::clear (this=0x1a79d6f8)
>     at /usr/include/c++/4.3/backward/hashtable.h:1081
> #1  0x08082235 in ~hashtable (this=0x1a79d6f8) at
> /usr/include/c++/4.3/backward/hashtable.h:360
> #2  0x080822c1 in ~hash_map (this=0x1a79d6f8) at
> /usr/include/c++/4.3/ext/hash_map:84
> #3  0x0808050a in ~CMap (this=0x1a79d6f8) at CMap.cpp:69
> #4  0x080ab061 in ~CWorld (this=0xbfb0c1a4) at CWorld.cpp:463
> #5  0x0825bf90 in luabind::detail::out_value_converter<524,
> luabind::detail::null_type>::converter_postcall<CWorld> (this=0xbfb0c1a4,
> L=0x1c641120) at /opt/include/luabind/out_value_policy.hpp:109
> #6  0x08262eaa in luabind::detail::invoke_member<luabind::adl::object
> (CWorld::*)(position, unsigned char),
> boost::mpl::vector4<luabind::adl::object, CWorld&, position, unsigned
> char>, luabind::detail::policy_cons<luabind::detail::out_value_policy<1,
> luabind::detail::null_type>, luabind::detail::null_type> > (L=0x1c641120,
> f=@0x1c65d228)
>     at
> /opt/include/boost-1_39/boost/preprocessor/iteration/detail/local.hpp:34
> #7  0x08263015 in luabind::detail::invoke0<luabind::adl::object
> (CWorld::*)(position, unsigned char),
> boost::mpl::vector4<luabind::adl::object, CWorld&, position, unsigned
> char>, luabind::detail::policy_cons<luabind::detail::out_value_policy<1,
> luabind::detail::null_type>, luabind::detail::null_type>,
> boost::is_void<luabind::adl::object> > (L=0x1c641120, f=@0x1c65d228,
> policies=@0xbfb0c527)
>     at /opt/include/luabind/detail/call.hpp:37
> #8  0x0826304e in luabind::detail::invoke<luabind::adl::object
> (CWorld::*)(position, unsigned char),
> boost::mpl::vector4<luabind::adl::object, CWorld&, position, unsigned
> char>, luabind::detail::policy_cons<luabind::detail::out_value_policy<1,
> luabind::detail::null_type>, luabind::detail::null_type> > (L=0x1c641120,
> f=@0x1c65d228, policies=@0xbfb0c527) at
> /opt/include/luabind/detail/call.hpp:58
> #9  0x08263077 in luabind::detail::function_invoke<luabind::adl::object
> (CWorld::*)(position, unsigned char),
> boost::mpl::vector4<luabind::adl::object, CWorld&, position, unsigned
> char>, luabind::detail::policy_cons<luabind::detail::out_value_policy<1,
> luabind::detail::null_type>, luabind::detail::null_type> >::operator()
> (this=0x1c65d228, L=0x1c641120) at
> /opt/include/luabind/make_function.hpp:31
> #10 0x08263097 in
> boost::detail::function::function_obj_invoker1<luabind::detail::function_invoke<luabind::adl::object
> (CWorld::*)(position, unsigned char),
> boost::mpl::vector4<luabind::adl::object, CWorld&, position, unsigned
> char>, luabind::detail::policy_cons<luabind::detail::out_value_policy<1,
> luabind::detail::null_type>, luabind::detail::null_type> >, int,
> lua_State*>::invoke (
>     function_obj_ptr=@0x1c65d228, a0=0x1c641120) at
> /opt/include/boost-1_39/boost/function/function_template.hpp:131
> #11 0xb7c90c0b in boost::function1<int, lua_State*>::operator()
> (this=0x1c65d224, a0=0x1c641120) at
> /home/vilarion/boost_1_39_0/boost/function/function_template.hpp:989
> #12 0xb7c9240c in call (this=0x1c65d21c, L=0x1c641120) at
> src/function.cpp:114
> #13 0xb7c9167f in call<const luabind::detail::<unnamed>::function* const,
> lua_State*> (this=0xbfb0c6f8, u=@0xbfb0c700, b1=@0xbfb0c650) at
> /home/vilarion/boost_1_39_0/boost/bind/mem_fn_template.hpp:217
> #14 0xb7c916a8 in operator()<const luabind::detail::<unnamed>::function*>
> (this=0xbfb0c6f8, u=@0xbfb0c700, a1=0x1c641120) at
> /home/vilarion/boost_1_39_0/boost/bind/mem_fn_template.hpp:226
> #15 0xb7c916ff in operator()<int, boost::_mfi::cmf1<int,
> luabind::detail::<unnamed>::function, lua_State*>, boost::_bi::list0>
> (this=0xbfb0c700, f=@0xbfb0c6f8, a=@0xbfb0c6a3)
>     at /home/vilarion/boost_1_39_0/boost/bind/bind.hpp:296
> #16 0xb7c9174e in operator() (this=0xbfb0c6f8) at
> /home/vilarion/boost_1_39_0/boost/bind/bind_template.hpp:20
> #17 0xb7c9185b in handle_exceptions<int, boost::_bi::bind_t<int,
> boost::_mfi::cmf1<int, luabind::detail::<unnamed>::function, lua_State*>,
> boost::_bi::list2<boost::_bi::value<const
> luabind::detail::<unnamed>::function*>, boost::_bi::value<lua_State*> > >
>  
>> (L=0x1c641120, fn=
>>    
>             {f_ = {f_ = 0xb7c921bc <call>}, l_ =
> {<boost::_bi::storage2<boost::_bi::value<const
> luabind::detail::<unnamed>::function*>,
> boost::_bi::value<lua_State*> >> =
> {<boost::_bi::storage1<boost::_bi::value<const
> luabind::detail::<unnamed>::function*> >> = {a1_ = {t_ =
> 0x1c65d21c}}, a2_ = {t_ = 0x1c641120}}, <No data fields>}}) at
> ./luabind/exception_handler.hpp:94
> #18 0xb7c92161 in function_dispatcher (L=0x1c641120) at src/function.cpp:125
> #19 0x082c2b05 in luaD_precall ()
> #20 0x082cc040 in luaV_execute ()
> #21 0x082c30a8 in luaD_call ()
> #22 0x082c0181 in f_call ()
> #23 0x082c26b7 in luaD_rawrunprotected ()
> #24 0x082c271f in luaD_pcall ()
> #25 0x082bff9b in lua_pcall ()
> #26 0xb7c93ac7 in luabind::detail::pcall (L=0x1c641120, nargs=0,
> nresults=0) at src/pcall.cpp:42
> #27 0x08270aa4 in ~proxy_function_void_caller (this=0xbfb0ca5c) at
> /opt/include/luabind/detail/call_function.hpp:262
> #28 0x0826e60d in CLuaNPCScript::nextCycle (this=0x1c6223d0) at
> script/CLuaNPCScript.cpp:25
> #29 0x080a7605 in CWorld::checkNPC (this=0xa22c860) at CWorld.cpp:907
> #30 0x080aae3f in CWorld::turntheworld (this=0xa22c860) at CWorld.cpp:509
> #31 0x08135709 in main (argc=2, argv=0xbfb0d024) at main.cpp:211
>
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> luabind-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>  


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user