Segfault when processing contacts

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Segfault when processing contacts

Postby hpesoj » Sat Jan 03, 2009 10:35 pm

Apologies if this is in fact due to a fault of my own, but I thought it would be most sensible to post in here.

All I can really say is that the problem seems to occur when there are many collisions going on - a pile of 500-600 spheres perhaps. I am not using multi-threading as that is also giving me problems (but that is beside the point), and my use of Newton functions is limited to simple World and Body creation functions.

Several different stack traces are pasted below, and I am using 64-bit Linux.

Code: Select all
test_app (Debug) [C/C++ Local Application]   
   gdb/mi (04/01/09 01:53) (Suspended)   
      Thread [1] (Suspended: Signal 'SIGSEGV' received. Description: Segmentation fault.)   
         34 <symbol is not available> 0x00007f20771f3b72   
         33 malloc()  0x00007f20771f5538   
         32 dgMalloc()  0x00007f20781b2ca5   
         31 dgWorld::ProcessContacts()  0x00007f20781f14fb   
         30 dgBroadPhaseMaterialCallbackWorkerThread::ThreadExecute()  0x00007f20781f89d9   
         29 dgBroadPhaseCollision::UpdateContacts()  0x00007f20781fd390   
         28 dgWorld::Update()  0x00007f207828ac31   
         27 Newton::UpdatePhysics()  0x00007f207819fdf0   
         26 NewtonUpdate()  0x00007f20781994d3   
         25 simi::BasicWorldManager::update() /home/joseph/dev/projects/simi/trunk/engine/src2/Simi_BasicWorldManager.cpp:102 0x00007f207810abe3   
         24 boost::python::detail::invoke<int, void (simi::WorldManager::*)(float), boost::python::arg_from_python<simi::WorldManager&>, boost::python::arg_from_python<float> >() /usr/local/include/boost-1_37/boost/python/detail/invoke.hpp:94 0x00007f20780f0430   
         23 boost::python::detail::caller_arity<2u>::impl<void (simi::WorldManager::*)(float), boost::python::default_call_policies, boost::mpl::vector3<void, simi::WorldManager&, float> >::operator() /usr/local/include/boost-1_37/boost/python/detail/caller.hpp:223 0x00007f20780f8776   
         22 boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (simi::WorldManager::*)(float), boost::python::default_call_policies, boost::mpl::vector3<void, simi::WorldManager&, float> > >::operator() /usr/local/include/boost-1_37/boost/python/object/py_function.hpp:38 0x00007f20780f880f   
         21 boost::python::objects::function::call()  0x00007f2079ce745b   
         20 <symbol is not available> 0x00007f2079ce7888   
         19 boost::function0<void>::operator()  0x00007f2079cf0bc4   
         18 boost::python::handle_exception_impl()  0x00007f2079cf0255   
         17 <symbol is not available> 0x00007f2079ce4dc2   
         16 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f2079f5a3c5   
         15 PyEval_EvalFrame_value() /home/joseph/dev/stackless/release26-maint/Python/ceval.c:4221 0x00007f207a000ea5   
         14 slp_frame_dispatch_top() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:698 0x00007f207a005105   
         13 slp_run_tasklet() /home/joseph/dev/stackless/release26-maint/Stackless/module/scheduling.c:1190 0x00007f207a0099f3   
         12 slp_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:299 0x00007f207a005dd5   
         11 climb_stack_and_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:266 0x00007f207a005cba   
         10 slp_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:294 0x00007f207a005d55   
         9 function_call() /home/joseph/dev/stackless/release26-maint/Objects/funcobject.c:527 0x00007f2079f8856b   
         8 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f2079f5a3c5   
         7 instancemethod_call() /home/joseph/dev/stackless/release26-maint/Objects/classobject.c:2586 0x00007f2079f6ac26   
         6 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f2079f5a3c5   
         5 PyEval_CallObjectWithKeywords() /home/joseph/dev/stackless/release26-maint/Python/ceval.c:3860 0x00007f2079ffba97   
         4 PyEval_CallFunction() /home/joseph/dev/stackless/release26-maint/Python/modsupport.c:556 0x00007f207a02bdc4   
         3 boost::python::api::object_operators<boost::python::api::proxy<boost::python::api::attribute_policies> >::operator()  0x00007f2079cd9b54   
         2 simi::Engine::run() /home/joseph/dev/projects/simi/trunk/engine/src2/Simi_Engine.cpp:380 0x00007f2078129530   
         1 main() /home/joseph/dev/projects/simi/trunk/apps/test_app/src/test_app.cpp:25 0x0000000000401b83   
   gdb (04/01/09 01:53)   
   /home/joseph/dev/projects/simi/trunk/apps/test_app/Debug/test_app (04/01/09 01:53)   





test_app (Debug) [C/C++ Local Application]   
   gdb/mi (04/01/09 01:53) (Suspended)   
      Thread [1] (Suspended: Signal 'SIGSEGV' received. Description: Segmentation fault.)   
         34 <symbol is not available> 0x00007f20771f3b72   
         33 malloc()  0x00007f20771f5538   
         32 dgMalloc()  0x00007f20781b2ca5   
         31 dgWorld::ProcessContacts()  0x00007f20781f14fb   
         30 dgBroadPhaseMaterialCallbackWorkerThread::ThreadExecute()  0x00007f20781f89d9   
         29 dgBroadPhaseCollision::UpdateContacts()  0x00007f20781fd390   
         28 dgWorld::Update()  0x00007f207828ac31   
         27 Newton::UpdatePhysics()  0x00007f207819fdf0   
         26 NewtonUpdate()  0x00007f20781994d3   
         25 simi::BasicWorldManager::update() /home/joseph/dev/projects/simi/trunk/engine/src2/Simi_BasicWorldManager.cpp:102 0x00007f207810abe3   
         24 boost::python::detail::invoke<int, void (simi::WorldManager::*)(float), boost::python::arg_from_python<simi::WorldManager&>, boost::python::arg_from_python<float> >() /usr/local/include/boost-1_37/boost/python/detail/invoke.hpp:94 0x00007f20780f0430   
         23 boost::python::detail::caller_arity<2u>::impl<void (simi::WorldManager::*)(float), boost::python::default_call_policies, boost::mpl::vector3<void, simi::WorldManager&, float> >::operator() /usr/local/include/boost-1_37/boost/python/detail/caller.hpp:223 0x00007f20780f8776   
         22 boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (simi::WorldManager::*)(float), boost::python::default_call_policies, boost::mpl::vector3<void, simi::WorldManager&, float> > >::operator() /usr/local/include/boost-1_37/boost/python/object/py_function.hpp:38 0x00007f20780f880f   
         21 boost::python::objects::function::call()  0x00007f2079ce745b   
         20 <symbol is not available> 0x00007f2079ce7888   
         19 boost::function0<void>::operator()  0x00007f2079cf0bc4   
         18 boost::python::handle_exception_impl()  0x00007f2079cf0255   
         17 <symbol is not available> 0x00007f2079ce4dc2   
         16 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f2079f5a3c5   
         15 PyEval_EvalFrame_value() /home/joseph/dev/stackless/release26-maint/Python/ceval.c:4221 0x00007f207a000ea5   
         14 slp_frame_dispatch_top() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:698 0x00007f207a005105   
         13 slp_run_tasklet() /home/joseph/dev/stackless/release26-maint/Stackless/module/scheduling.c:1190 0x00007f207a0099f3   
         12 slp_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:299 0x00007f207a005dd5   
         11 climb_stack_and_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:266 0x00007f207a005cba   
         10 slp_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:294 0x00007f207a005d55   
         9 function_call() /home/joseph/dev/stackless/release26-maint/Objects/funcobject.c:527 0x00007f2079f8856b   
         8 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f2079f5a3c5   
         7 instancemethod_call() /home/joseph/dev/stackless/release26-maint/Objects/classobject.c:2586 0x00007f2079f6ac26   
         6 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f2079f5a3c5   
         5 PyEval_CallObjectWithKeywords() /home/joseph/dev/stackless/release26-maint/Python/ceval.c:3860 0x00007f2079ffba97   
         4 PyEval_CallFunction() /home/joseph/dev/stackless/release26-maint/Python/modsupport.c:556 0x00007f207a02bdc4   
         3 boost::python::api::object_operators<boost::python::api::proxy<boost::python::api::attribute_policies> >::operator()  0x00007f2079cd9b54   
         2 simi::Engine::run() /home/joseph/dev/projects/simi/trunk/engine/src2/Simi_Engine.cpp:380 0x00007f2078129530   
         1 main() /home/joseph/dev/projects/simi/trunk/apps/test_app/src/test_app.cpp:25 0x0000000000401b83   
   gdb (04/01/09 01:53)   
   /home/joseph/dev/projects/simi/trunk/apps/test_app/Debug/test_app (04/01/09 01:53)   





test_app (Debug) [C/C++ Local Application]   
   gdb/mi (04/01/09 01:58) (Suspended)   
      Thread [1] (Suspended: Signal 'SIGABRT' received. Description: Aborted.)   
         36 raise()  0x00007f7d9cce7fd5   
         35 abort()  0x00007f7d9cce9b43   
         34 <symbol is not available> 0x00007f7d9cd28fa8   
         33 <symbol is not available> 0x00007f7d9cd2e938   
         32 dgFree()  0x00007f7d9dcf0b15   
         31 dgBroadPhaseCalculateContactsWorkerThread::Realloc()  0x00007f7d9dd36ae9   
         30 dgBroadPhaseCalculateContactsWorkerThread::ThreadExecute()  0x00007f7d9dd36d6d   
         29 dgBroadPhaseCollision::UpdateContacts()  0x00007f7d9dd3b327   
         28 dgWorld::Update()  0x00007f7d9ddc8c31   
         27 Newton::UpdatePhysics()  0x00007f7d9dcdddf0   
         26 NewtonUpdate()  0x00007f7d9dcd74d3   
         25 simi::BasicWorldManager::update() /home/joseph/dev/projects/simi/trunk/engine/src2/Simi_BasicWorldManager.cpp:102 0x00007f7d9dc48be3   
         24 boost::python::detail::invoke<int, void (simi::WorldManager::*)(float), boost::python::arg_from_python<simi::WorldManager&>, boost::python::arg_from_python<float> >() /usr/local/include/boost-1_37/boost/python/detail/invoke.hpp:94 0x00007f7d9dc2e430   
         23 boost::python::detail::caller_arity<2u>::impl<void (simi::WorldManager::*)(float), boost::python::default_call_policies, boost::mpl::vector3<void, simi::WorldManager&, float> >::operator() /usr/local/include/boost-1_37/boost/python/detail/caller.hpp:223 0x00007f7d9dc36776   
         22 boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (simi::WorldManager::*)(float), boost::python::default_call_policies, boost::mpl::vector3<void, simi::WorldManager&, float> > >::operator() /usr/local/include/boost-1_37/boost/python/object/py_function.hpp:38 0x00007f7d9dc3680f   
         21 boost::python::objects::function::call()  0x00007f7d9f82545b   
         20 <symbol is not available> 0x00007f7d9f825888   
         19 boost::function0<void>::operator()  0x00007f7d9f82ebc4   
         18 boost::python::handle_exception_impl()  0x00007f7d9f82e255   
         17 <symbol is not available> 0x00007f7d9f822dc2   
         16 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f7d9fa983c5   
         15 PyEval_EvalFrame_value() /home/joseph/dev/stackless/release26-maint/Python/ceval.c:4221 0x00007f7d9fb3eea5   
         14 slp_frame_dispatch_top() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:698 0x00007f7d9fb43105   
         13 slp_run_tasklet() /home/joseph/dev/stackless/release26-maint/Stackless/module/scheduling.c:1190 0x00007f7d9fb479f3   
         12 slp_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:299 0x00007f7d9fb43dd5   
         11 climb_stack_and_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:266 0x00007f7d9fb43cba   
         10 slp_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:294 0x00007f7d9fb43d55   
         9 function_call() /home/joseph/dev/stackless/release26-maint/Objects/funcobject.c:527 0x00007f7d9fac656b   
         8 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f7d9fa983c5   
         7 instancemethod_call() /home/joseph/dev/stackless/release26-maint/Objects/classobject.c:2586 0x00007f7d9faa8c26   
         6 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f7d9fa983c5   
         5 PyEval_CallObjectWithKeywords() /home/joseph/dev/stackless/release26-maint/Python/ceval.c:3860 0x00007f7d9fb39a97   
         4 PyEval_CallFunction() /home/joseph/dev/stackless/release26-maint/Python/modsupport.c:556 0x00007f7d9fb69dc4   
         3 boost::python::api::object_operators<boost::python::api::proxy<boost::python::api::attribute_policies> >::operator()  0x00007f7d9f817b54   
         2 simi::Engine::run() /home/joseph/dev/projects/simi/trunk/engine/src2/Simi_Engine.cpp:380 0x00007f7d9dc67530   
         1 main() /home/joseph/dev/projects/simi/trunk/apps/test_app/src/test_app.cpp:25 0x0000000000401b83   
   gdb (04/01/09 01:58)   
   /home/joseph/dev/projects/simi/trunk/apps/test_app/Debug/test_app (04/01/09 01:58)   








test_app (Debug) [C/C++ Local Application]   
   gdb/mi (04/01/09 02:18) (Suspended)   
      Thread [1] (Suspended: Signal 'SIGSEGV' received. Description: Segmentation fault.)   
         34 <symbol is not available> 0x00007f58c0a0fe02   
         33 malloc()  0x00007f58c0a11538   
         32 dgMalloc()  0x00007f58c19ced41   
         31 dgCollidingPairCollector::FlushChache()  0x00007f58c1ad59c1   
         30 dgBroadPhaseCollision::UpdateContactsBroadPhaseBegin()  0x00007f58c1a19160   
         29 dgBroadPhaseCollision::UpdateContacts()  0x00007f58c1a191bb   
         28 dgWorld::Update()  0x00007f58c1aa6cf1   
         27 Newton::UpdatePhysics()  0x00007f58c19bbeb0   
         26 NewtonUpdate()  0x00007f58c19b5593   
         25 simi::BasicWorldManager::update() /home/joseph/dev/projects/simi/trunk/engine/src2/Simi_BasicWorldManager.cpp:102 0x00007f58c1926c43   
         24 boost::python::detail::invoke<int, void (simi::WorldManager::*)(float), boost::python::arg_from_python<simi::WorldManager&>, boost::python::arg_from_python<float> >() /usr/local/include/boost-1_37/boost/python/detail/invoke.hpp:94 0x00007f58c190c490   
         23 boost::python::detail::caller_arity<2u>::impl<void (simi::WorldManager::*)(float), boost::python::default_call_policies, boost::mpl::vector3<void, simi::WorldManager&, float> >::operator() /usr/local/include/boost-1_37/boost/python/detail/caller.hpp:223 0x00007f58c19147d6   
         22 boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (simi::WorldManager::*)(float), boost::python::default_call_policies, boost::mpl::vector3<void, simi::WorldManager&, float> > >::operator() /usr/local/include/boost-1_37/boost/python/object/py_function.hpp:38 0x00007f58c191486f   
         21 boost::python::objects::function::call()  0x00007f58c350445b   
         20 <symbol is not available> 0x00007f58c3504888   
         19 boost::function0<void>::operator()  0x00007f58c350dbc4   
         18 boost::python::handle_exception_impl()  0x00007f58c350d255   
         17 <symbol is not available> 0x00007f58c3501dc2   
         16 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f58c37773c5   
         15 PyEval_EvalFrame_value() /home/joseph/dev/stackless/release26-maint/Python/ceval.c:4221 0x00007f58c381dea5   
         14 slp_frame_dispatch_top() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:698 0x00007f58c3822105   
         13 slp_run_tasklet() /home/joseph/dev/stackless/release26-maint/Stackless/module/scheduling.c:1190 0x00007f58c38269f3   
         12 slp_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:299 0x00007f58c3822dd5   
         11 climb_stack_and_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:266 0x00007f58c3822cba   
         10 slp_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:294 0x00007f58c3822d55   
         9 function_call() /home/joseph/dev/stackless/release26-maint/Objects/funcobject.c:527 0x00007f58c37a556b   
         8 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f58c37773c5   
         7 instancemethod_call() /home/joseph/dev/stackless/release26-maint/Objects/classobject.c:2586 0x00007f58c3787c26   
         6 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f58c37773c5   
         5 PyEval_CallObjectWithKeywords() /home/joseph/dev/stackless/release26-maint/Python/ceval.c:3860 0x00007f58c3818a97   
         4 PyEval_CallFunction() /home/joseph/dev/stackless/release26-maint/Python/modsupport.c:556 0x00007f58c3848dc4   
         3 boost::python::api::object_operators<boost::python::api::proxy<boost::python::api::attribute_policies> >::operator()  0x00007f58c34f6b54   
         2 simi::Engine::run() /home/joseph/dev/projects/simi/trunk/engine/src2/Simi_Engine.cpp:380 0x00007f58c1945590   
         1 main() /home/joseph/dev/projects/simi/trunk/apps/test_app/src/test_app.cpp:25 0x0000000000401b83   
   gdb (04/01/09 02:18)   
   /home/joseph/dev/projects/simi/trunk/apps/test_app/Debug/test_app (04/01/09 02:18)   

hpesoj
 
Posts: 90
Joined: Sun Jan 09, 2005 4:36 pm
Location: Cambridge/Bristol, UK

Re: Segfault when processing contacts

Postby Julio Jerez » Sat Jan 03, 2009 11:48 pm

It looks like is crashing in malloc?
Is this beta 17?
Is the crash consistent?

It look like is crashing in malloc
I have made chnage to the SDK for beta18, so teh best thong will be for me to buidl teh linux build and so that you can link the new library and see ofi the bug is atill there.
If it is the maybe you can send me a test to see what it is.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Segfault when processing contacts

Postby hpesoj » Sun Jan 04, 2009 9:16 am

Thanks for the fast reply, much appreciated. Yep, latest version, and yeah, it's problems allocating and freeing memory. It is reproducible every single time (although as you can see, different setups result in slightly different stack traces). If you could upload the 64 bit Linux library I'll very happily give it a go asap.
hpesoj
 
Posts: 90
Joined: Sun Jan 09, 2005 4:36 pm
Location: Cambridge/Bristol, UK

Re: Segfault when processing contacts

Postby agi_shi » Sun Jan 04, 2009 10:12 am

I'm going to have to confirm this, I have several reports of Portalized crashing the same way with a couple of hundred of objects.
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Segfault when processing contacts

Postby Julio Jerez » Sun Jan 04, 2009 1:40 pm

Agi please can you veryfied that?
It is very possibel thet teh is a bug there but It is hard fo rme fo debug in linux specially.
if can send you a debug build so the you can test.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Segfault when processing contacts

Postby agi_shi » Sun Jan 04, 2009 2:09 pm

Sure, I'll look into it.

Edit: Our Linux versions still build against beta14, what is the latest version we should build against so we can debug this bug? :twisted: (both 64-bit and and 32-bit)
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Segfault when processing contacts

Postby hpesoj » Sun Jan 04, 2009 2:47 pm

Where can I find which beta I am using? I assumed that I was using the latest version as I downloaded it in the past few days, from the link Julio gave me a while ago, but the files seem kind of old (last updated in September).
hpesoj
 
Posts: 90
Joined: Sun Jan 09, 2005 4:36 pm
Location: Cambridge/Bristol, UK

Re: Segfault when processing contacts

Postby hpesoj » Sun Jan 04, 2009 3:52 pm

I think I have somewhat narrowed down the cause of the bug (though the reason is still beyond me). Very simply, if I load the Ogre RenderSystem_GL.so, I get segfaults when stacking large numbers of objects. If I don't load the plugin, everything is fine. Does that give you any ideas, or are you still as clueless as I am?

[edit]
Note also that although I am loading an Ogre library, thereafter I am not using Ogre in any way, just pure Newton in the update loop. The problem seems to be due to something that is going on inside the plugin's "dllStartPlugin" function.
hpesoj
 
Posts: 90
Joined: Sun Jan 09, 2005 4:36 pm
Location: Cambridge/Bristol, UK

Re: Segfault when processing contacts

Postby JernejL » Sun Jan 04, 2009 4:32 pm

Perhaps ogre dll sets the 8087 FPU control word (asm FLDCW) to something that breaks newton? i seen injected DLLs change the control word of processes which caused divisions by zero to become fatal and cause spectacular unexplainable program crashes.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Segfault when processing contacts

Postby Julio Jerez » Sun Jan 04, 2009 4:47 pm

hpesoj wrote:I think I have somewhat narrowed down the cause of the bug (though the reason is still beyond me). Very simply, if I load the Ogre RenderSystem_GL.so, I get segfaults when stacking large numbers of objects. If I don't load the plugin, everything is fine. Does that give you any ideas, or are you still as clueless as I am?


you should try downloading the SDK again,
In my side I nee to bring Linux to beta 18 I can not ever run eth demos sicene soem funtion has change since the last linux build.
I am finushing a feature now but as soon as I get thet wraps I will make bring linux uptodate
The current version is 18 but only the window32 is ready, the is why I have no announce it.

do you run in linux32 as well, or can you
I say this is see if it is a 64/32 bit issue since it apears it appear it happen on malloc.

here is an idea, cna you pass to allocatior to teh engine and they when it crash you cna check if teh call to malloc is made with some bogus value.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Segfault when processing contacts

Postby hpesoj » Sun Jan 04, 2009 5:38 pm

I have downloaded the SDK several times with no avail. I have the 19th September version (if this isn't beta17 then I need an updated link). I don't currently have 32-bit Linux installed, but it wouldn't be too much of a problem to install if it helps.

Success on the custom allocator front. With one arrangement of bodies, the dealloc is passed a bogus pointer (was never passed to alloc), with another arrangement, the same (valid) pointer was passed to dealloc several times. With another configuration (many columns of cubes this time), alloc and dealloc were not involved, see stack trace below.

Code: Select all
test_app (Debug) [C/C++ Local Application]   
   gdb/mi (04/01/09 21:31) (Suspended)   
      Thread [1] (Suspended: Signal 'SIGSEGV' received. Description: Segmentation fault.)   
         31 dgWorldDynamicUpdate::BuildJacobianMatrix()  0x00007f0bc68e048f   
         30 dgSolverWorlkerThreads::ThreadExecute()  0x00007f0bc68e7c2f   
         29 dgWorldDynamicUpdate::UpdateDynamics()  0x00007f0bc68db194   
         28 dgWorld::Update()  0x00007f0bc68be918   
         27 Newton::UpdatePhysics()  0x00007f0bc67d3ac0   
         26 NewtonUpdate()  0x00007f0bc67cd1a3   
         25 simi::BasicWorldManager::update() /home/joseph/dev/projects/simi/trunk/engine/src2/Simi_BasicWorldManager.cpp:99 0x00007f0bc67386cb   
         24 boost::python::detail::invoke<int, void (simi::WorldManager::*)(float), boost::python::arg_from_python<simi::WorldManager&>, boost::python::arg_from_python<float> >() /usr/local/include/boost-1_37/boost/python/detail/invoke.hpp:94 0x00007f0bc671dd20   
         23 boost::python::detail::caller_arity<2u>::impl<void (simi::WorldManager::*)(float), boost::python::default_call_policies, boost::mpl::vector3<void, simi::WorldManager&, float> >::operator() /usr/local/include/boost-1_37/boost/python/detail/caller.hpp:223 0x00007f0bc6726066   
         22 boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (simi::WorldManager::*)(float), boost::python::default_call_policies, boost::mpl::vector3<void, simi::WorldManager&, float> > >::operator() /usr/local/include/boost-1_37/boost/python/object/py_function.hpp:38 0x00007f0bc67260ff   
         21 boost::python::objects::function::call()  0x00007f0bc831c45b   
         20 <symbol is not available> 0x00007f0bc831c888   
         19 boost::function0<void>::operator()  0x00007f0bc8325bc4   
         18 boost::python::handle_exception_impl()  0x00007f0bc8325255   
         17 <symbol is not available> 0x00007f0bc8319dc2   
         16 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f0bc858f3c5   
         15 PyEval_EvalFrame_value() /home/joseph/dev/stackless/release26-maint/Python/ceval.c:4221 0x00007f0bc8635ea5   
         14 slp_frame_dispatch_top() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:698 0x00007f0bc863a105   
         13 slp_run_tasklet() /home/joseph/dev/stackless/release26-maint/Stackless/module/scheduling.c:1190 0x00007f0bc863e9f3   
         12 slp_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:299 0x00007f0bc863add5   
         11 climb_stack_and_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:266 0x00007f0bc863acba   
         10 slp_eval_frame() /home/joseph/dev/stackless/release26-maint/Stackless/core/stacklesseval.c:294 0x00007f0bc863ad55   
         9 function_call() /home/joseph/dev/stackless/release26-maint/Objects/funcobject.c:527 0x00007f0bc85bd56b   
         8 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f0bc858f3c5   
         7 instancemethod_call() /home/joseph/dev/stackless/release26-maint/Objects/classobject.c:2586 0x00007f0bc859fc26   
         6 PyObject_Call() /home/joseph/dev/stackless/release26-maint/Objects/abstract.c:2489 0x00007f0bc858f3c5   
         5 PyEval_CallObjectWithKeywords() /home/joseph/dev/stackless/release26-maint/Python/ceval.c:3860 0x00007f0bc8630a97   
         4 PyEval_CallFunction() /home/joseph/dev/stackless/release26-maint/Python/modsupport.c:556 0x00007f0bc8660dc4   
         3 boost::python::api::object_operators<boost::python::api::proxy<boost::python::api::attribute_policies> >::operator()  0x00007f0bc830eb54   
         2 simi::Engine::run() /home/joseph/dev/projects/simi/trunk/engine/src2/Simi_Engine.cpp:380 0x00007f0bc6758094   
         1 main() /home/joseph/dev/projects/simi/trunk/apps/test_app/src/test_app.cpp:34 0x0000000000401b83   
   gdb (04/01/09 21:31)   
   /home/joseph/dev/projects/simi/trunk/apps/test_app/Debug/test_app (04/01/09 21:31)   
hpesoj
 
Posts: 90
Joined: Sun Jan 09, 2005 4:36 pm
Location: Cambridge/Bristol, UK

Re: Segfault when processing contacts

Postby agi_shi » Sun Jan 04, 2009 5:42 pm

I am indeed using Ogre, too, so maybe the crash is somehow related to the RenderSystem_GL library ... hm.
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Segfault when processing contacts

Postby hpesoj » Sun Jan 04, 2009 6:28 pm

@julio and agi
Here is a code snippet that reproduces the errors I am getting. You'll need to include the minimalMath cpp files in the project, and obviously link to the Newton and Ogre (I'm using Shoggoth) libraries, and make sure to change the plugin path if necessary.

Code: Select all
/*
 * @file newton_test.cpp
 *
 * @date 04-Jan-2009
 * @author joseph
 */

#include <cmath>
#include <iostream>
#include <algorithm>
#include <map>
#include <cstdlib>

#include <OgreRoot.h>

#include <Newton.h>
#include <dVector.h>
#include <dQuaternion.h>
#include <dMatrix.h>

// Change to the plugin path containing RenderSystem_GL
const Ogre::String pluginPath = "/usr/local/lib/OGRE/";

const dFloat runForSeconds = 100.0;
const dFloat frameRate = 60;

const dFloat pi = 3.14159265358979323846;
const dFloat gravity = -9.8;
const dFloat sphereMass = 10.0;

const int rows = 80;
const int segments = 13;
const dFloat radius = 6.0;
const dFloat segAngle = 2 * pi / segments;

std::map<void*, int> allocs;

void* customAlloc(int sizeInBytes)
{
    void* ptr = malloc(sizeInBytes);
    std::cout << "Alloc: " << ptr << ", " << sizeInBytes << std::endl;
    allocs[ptr] = sizeInBytes;
    return ptr;
}

void customDealloc(void* ptr, int sizeInBytes)
{
    std::cout << "Dealloc: " << ptr << ", " << sizeInBytes << std::endl;

    if (allocs.find(ptr) == allocs.end())
        std::cout << "Bogus ptr: " << ptr << std::endl;
    else if (allocs[ptr] != sizeInBytes)
    {
        std::cout << "Bogus size: " << sizeInBytes << " should be " <<
            allocs[ptr] << std::endl;
    }

    free(ptr);
}

void gravityCallback(
        const NewtonBody* body, dFloat timestep, int threadIndex)
{
    NewtonBodyAddForce(body, &(dVector(0.0, gravity * sphereMass, 0.0)[0]));
}

void newtonScene(void)
{
    NewtonWorld* world = NewtonCreate(customAlloc, customDealloc);

    // Create  floor.
    NewtonCollision* floorCol = NewtonCreateBox(world, 40, 2, 40, 0);
    NewtonBody* floor = NewtonCreateBody(world, floorCol);
    NewtonReleaseCollision(world, floorCol);
    dMatrix floorMat(dQuaternion(1, 0, 0, 0), dVector(0.0, -82.0, 0.0));
    NewtonBodySetMatrix(floor, &(floorMat[0][0]));

    // Create a whole bunch of spheres stacked like in the tower demo.
    NewtonCollision* sphereCol = NewtonCreateSphere(world, 1, 1, 1, 0);
    NewtonBody* sphere = 0;

    dFloat angleOffset = 0.5;

    // Create a bunch of spheres in a tower shape, like the Newton towers.
    for (int r = 0; r < rows; r++)
    {
        angleOffset = 0.5 - angleOffset;
        for (int s = 0; s < segments; s++)
        {
            sphere = NewtonCreateBody(world, sphereCol);

            dFloat angle = segAngle * (s + angleOffset);
            dMatrix sphereMat(dQuaternion(), dVector(
                    std::sin(angle) * radius,
                    -80.0 + r * 2.1,
                    std::cos(angle) * radius));
            NewtonBodySetMatrix(sphere, &(sphereMat[0][0]));
            NewtonBodySetMassMatrix(sphere, sphereMass, 1, 1, 1);
            NewtonBodySetLinearDamping(sphere, 0.1);
            NewtonBodySetAngularDamping(sphere, &(dVector(0.1, 0.1, 0.1)[0]));
            NewtonBodySetForceAndTorqueCallback(sphere, gravityCallback);
        }
    }

    NewtonReleaseCollision(world, sphereCol);

    // Do loop!
    for (int c = 0; c < runForSeconds * frameRate; c++)
    {
        NewtonUpdate(world, 1.0 / frameRate);
    }

    NewtonDestroy(world);
}

int main(void)
{
    Ogre::Root* root = new Ogre::Root();
    root->loadPlugin(pluginPath + "RenderSystem_GL");

    newtonScene();

    delete root;

    std::cout << "Success!  Damn..." << std::endl;

    return 0;
}


EDIT
Updated code.
Last edited by hpesoj on Sun Jan 04, 2009 7:37 pm, edited 1 time in total.
hpesoj
 
Posts: 90
Joined: Sun Jan 09, 2005 4:36 pm
Location: Cambridge/Bristol, UK

Re: Segfault when processing contacts

Postby Julio Jerez » Sun Jan 04, 2009 6:47 pm

Is that all I need?

I have a question do you know if this bug happens using windows?
The reason I ask is because I have never in 5 year being able to compile Ogre.
I find it too complex and overbearing and you need to get several other things to get it.
If I add to the problem that I am not proficient in Linux, believe me I will end up solving a different problem.
I know Ogre has precompiled build so maybe IO can use that, but I want to know you have tested it on window first.

I am downloading Ubunto 64 again.
for some reason it no longer boot in my system.

another thong has you download teh last vesion of the engine?
I cna devug this on tah version since teh new changes apply only to teh win32 at this time.
I like to find the crash bug before I do anything else.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Segfault when processing contacts

Postby hpesoj » Sun Jan 04, 2009 7:28 pm

That's all you need. I also had to link to the pthread library to get it to compile. There is no visualization though.

I do have Windows Vista installed, but I haven't tried to compile my project on there (I switched to Linux for the ease of development :P). I will try to get stuff set up, even though compiling libraries on windows is a hassle (hopefully I can find some binaries). I have compiled Ogre on windows before, usually the Codeblocks/VC++ project is up to date, and all you need is the separate dependencies on the Ogre website. I can't (won't) however find out if this is a 64-bit problem on Windows as well *shakes fist at 64-bit Windows*.

Julio Jerez wrote:another thong has you download teh last vesion of the engine?


I have downloaded the latest version of Newton as of today from the link you posted to me.
hpesoj
 
Posts: 90
Joined: Sun Jan 09, 2005 4:36 pm
Location: Cambridge/Bristol, UK

Next

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 13 guests

cron