Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

race condition, using uninitialized Scene::jointMsgs containing NaN's #333

Closed
osrf-migration opened this issue Dec 28, 2012 · 6 comments
Closed
Labels
all bug Something isn't working critical

Comments

@osrf-migration
Copy link

Original report (archived issue) by John Hsu (Bitbucket: hsu, GitHub: hsu).


starting pr2 simulation sometimes leads to this segfault:

(gdb) /home/hsu/projects/groovy/simulator_gazebo/gazebo/scripts/gui: line 2: 28902 Aborted                 (core dumped) `rospack find gazebo`/gazebo/bin/gzclient -g `rospack find gazebo`/lib/libgazebo_ros_paths_plugin.so
[gazebo_gui-3] process has died [pid 28899, exit code 134, cmd /home/hsu/projects/groovy/simulator_gazebo/gazebo/scripts/gui __name:=gazebo_gui __log:=/home/hsu/.ros/log/dc93b228-513e-11e2-944f-90e2ba191409/gazebo_gui-3.log].
log file: /home/hsu/.ros/log/dc93b228-513e-11e2-944f-90e2ba191409/gazebo_gui-3*.log
bt
#0  0x00007ffff4f6e425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff4f71b8b in __GI_abort () at abort.c:91
#2  0x00007ffff4f670ee in __assert_fail_base (fmt=<optimized out>, 
    assertion=0x7fffee9a63f0 "!pos.isNaN() && \"Invalid vector supplied as parameter\"", 
    file=0x7fffee9a62b0 "/tmp/buildd/ros-groovy-visualization-common-1.8.4/debian/ros-groovy-visualization-common/opt/ros/groovy/stacks/visualization_common/ogre/build/ogre_src_v1-7-3/OgreMain/src/OgreNode.cpp", line=<optimized out>, function=<optimized out>)
    at assert.c:94
#3  0x00007ffff4f67192 in __GI___assert_fail (
    assertion=0x7fffee9a63f0 "!pos.isNaN() && \"Invalid vector supplied as parameter\"", 
    file=0x7fffee9a62b0 "/tmp/buildd/ros-groovy-visualization-common-1.8.4/debian/ros-groovy-visualization-common/opt/ros/groovy/stacks/visualization_common/ogre/build/ogre_src_v1-7-3/OgreMain/src/OgreNode.cpp", line=413, 
    function=0x7fffee9a67e0 "virtual void Ogre::Node::setPosition(const Ogre::Vector3&)") at assert.c:103
#4  0x00007fffee7feb86 in setPosition (this=<optimized out>, pos=...)
    at /tmp/buildd/ros-groovy-visualization-common-1.8.4/debian/ros-groovy-visualization-common/opt/ros/groovy/stacks/visualization_common/ogre/build/ogre_src_v1-7-3/OgreMain/src/OgreNode.cpp:413
#5  Ogre::Node::setPosition (this=<optimized out>, pos=...)
    at /tmp/buildd/ros-groovy-visualization-common-1.8.4/debian/ros-groovy-visualization-common/opt/ros/groovy/stacks/visualization_common/ogre/build/ogre_src_v1-7-3/OgreMain/src/OgreNode.cpp:411
#6  0x00007fffee7fd972 in Ogre::Node::_setDerivedPosition (this=0x7fff48121f30, pos=...)
    at /tmp/buildd/ros-groovy-visualization-common-1.8.4/debian/ros-groovy-visualization-common/opt/ros/groovy/stacks/visualization_common/ogre/build/ogre_src_v1-7-3/OgreMain/src/OgreNode.cpp:548
#7  0x00007ffff29e4c86 in gazebo::rendering::Visual::SetWorldPosition (this=0xcbb2830, _pos=...)
    at /home/hsu/projects/groovy/simulator_gazebo/gazebo/build/gazebo-hg/gazebo/rendering/Visual.cc:1263
#8  0x00007ffff29645b9 in gazebo::rendering::JointVisual::Load (this=0xcbb2830, _msg=...)
    at /home/hsu/projects/groovy/simulator_gazebo/gazebo/build/gazebo-hg/gazebo/rendering/JointVisual.cc:55
#9  0x00007ffff29aa5fe in gazebo::rendering::Scene::ProcessJointMsg (this=0x16d8bb0, _msg=...)
    at /home/hsu/projects/groovy/simulator_gazebo/gazebo/build/gazebo-hg/gazebo/rendering/Scene.cc:1656
#10 0x00007ffff29a8be5 in gazebo::rendering::Scene::PreRender (this=0x16d8bb0)
    at /home/hsu/projects/groovy/simulator_gazebo/gazebo/build/gazebo-hg/gazebo/rendering/Scene.cc:1501
#11 0x00007ffff29ce118 in boost::_mfi::mf0<void, gazebo::rendering::Scene>::operator() (this=0x2945fe8, p=0x16d8bb0)
    at /usr/include/boost/bind/mem_fn_template.hpp:49
#12 0x00007ffff29ccd2e in boost::_bi::list1<boost::_bi::value<gazebo::rendering::Scene*> >::operator()<boost::_mfi::mf0<void, gazebo::rendering::Scene>, boost::_bi::list0> (this=0x2945ff8, f=..., a=...) at /usr/include/boost/bind/bind.hpp:253
#13 0x00007ffff29cb999 in boost::_bi::bind_t<void, boost::_mfi::mf0<void, gazebo::rendering::Scene>, boost::_bi::list1<boost::_bi::value<gazebo::rendering::Scene*> > >::operator() (this=0x2945fe8) at /usr/include/boost/bind/bind_template.hpp:20
#14 0x00007ffff29c9d8e in boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void, boost::_mfi::mf0<void, gazebo::rendering::Scene>, boost::_bi::list1<boost::_bi::value<gazebo::rendering::Scene*> > >, void>::invoke (function_obj_ptr=...)
    at /usr/include/boost/function/function_template.hpp:153
#15 0x00007ffff74242d4 in boost::function0<void>::operator() (this=0x2945fe0)
    at /usr/include/boost/function/function_template.hpp:1013
#16 0x00007ffff7427f0b in gazebo::event::EventT<void ()>::Signal() (this=0x7ffff7dd89e0)
    at /home/hsu/projects/groovy/simulator_gazebo/gazebo/build/gazebo-hg/gazebo/common/Event.hh:126
#17 0x00007ffff74258ce in gazebo::event::EventT<void ()>::operator()() (this=0x7ffff7dd89e0)
    at /home/hsu/projects/groovy/simulator_gazebo/gazebo/build/gazebo-hg/gazebo/common/Event.hh:119
#18 0x00007ffff6c65e94 in gazebo::sensors::SensorManager::Update (this=0x7ffff733f5a0, _force=false)
    at /home/hsu/projects/groovy/simulator_gazebo/gazebo/build/gazebo-hg/gazebo/sensors/SensorManager.cc:87
#19 0x00007ffff6c5ac2d in gazebo::sensors::run_once (_force=false)
    at /home/hsu/projects/groovy/simulator_gazebo/gazebo/build/gazebo-hg/gazebo/sensors/Sensors.cc:88
#20 0x00000000004697b1 in gazebo::Server::Run (this=0x6e96f0)
    at /home/hsu/projects/groovy/simulator_gazebo/gazebo/build/gazebo-hg/gazebo/Server.cc:371
#21 0x000000000046513f in main (argc=9, argv=0x7fffffffdcf8)
    at /home/hsu/projects/groovy/simulator_gazebo/gazebo/build/gazebo-hg/gazebo/server_main.cc:32
(gdb)
@osrf-migration
Copy link
Author

Original comment by John Hsu (Bitbucket: hsu, GitHub: hsu).


it seems the very first jointMsg has corrputed position values, printing them out before usage yields:

Error [JointVisual.cc:52] -0.310343 -0.067658 3.83382e+174
Error [Visual.cc:1263] -0.310343 -0.067658 3.83382e+174

but if I put a break point on

  jointVis->Load(_msg);

inside of Scene::ProcessJointMsg(...), and step through the first couple of calls manually, then sometimes the position values are ok and simulation runs without segfault.

@osrf-migration
Copy link
Author

Original comment by John Hsu (Bitbucket: hsu, GitHub: hsu).


Update

Turns out after tacking the ill formed values upstream, it was a typo on [parser_urdf.cc]https://github.com/osrf/gazebo/blob/12a2e98af84fb366d6e6e1e5bbc51fe2e630b198/gazebo/sdf/interface/parser_urdf.cc#L121)

Fixed in the branch.

The problem is because during the link loading loop, the call to link->load(linkElem), which calls Link::LoadCollision, which calls Entity::SetRelativePose, which ends up using potentially uninitialized parentEntity's worldPose.

@osrf-migration
Copy link
Author

Original comment by John Hsu (Bitbucket: hsu, GitHub: hsu).


pull request #210 initializes Entity::worldPose during construction to avoid NaN's.

@osrf-migration
Copy link
Author

Original comment by John Hsu (Bitbucket: hsu, GitHub: hsu).


  • changed state from "new" to "resolved"

fixed in the branch

@osrf-migration
Copy link
Author

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


  • set version to "all"

@osrf-migration
Copy link
Author

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


  • changed state from "resolved" to "closed"

@osrf-migration osrf-migration added critical bug Something isn't working all labels Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
all bug Something isn't working critical
Projects
None yet
Development

No branches or pull requests

1 participant