Gazebo Segmentation Fault in std::__atomic_base<bool>::load

asked 2021-06-09 10:08:05 -0600

awck gravatar image

Hi,

My ROS Network consists of 2 main parts: (1) a few C++ robot-nodes that simulate my robot and (2) a Python control script. In the Python control script I need to reset my world, which includes respawning the robot. To respawn the robot I do the following in my Python node:

  1. I kill the robot's "controller_spawners" of the "gazebo_ros_control" package using os.system("rosnode kill controller_spawner")
  2. I delete the Gazebo model using a ROS service
  3. I respawn the URDF geometry using a ROS service
  4. Then I respawn the controllers again

For some reason my Gazebo 11 simulator sometimes seg-faults after step 1 with the below backtrace. It only happens very rarely (every 2 hours or so), which makes this problem annoying and difficult to debug. Any help is greatly appreciated!

--Type <RET> for more, q to quit, c to continue without paging--

Thread 31 "gzserver" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff854a8700 (LWP 454777)]
0x00007ffff6bb5df4 in std::__atomic_base<bool>::load (
    __m=std::memory_order_seq_cst, this=0x7fffd800b4c0)
    at /usr/include/c++/9/bits/atomic_base.h:413
413       load(memory_order __m = memory_order_seq_cst) const noexcept
(gdb) bt
#0  0x00007ffff6bb5df4 in std::__atomic_base<bool>::load(std::memory_order) const (__m=std::memory_order_seq_cst, this=0x7fffd800b4c0)
    at /usr/include/c++/9/bits/atomic_base.h:413
#1  std::atomic<bool>::operator bool() const (this=0x7fffd800b4c0)
    at /usr/include/c++/9/atomic:88
#2  gazebo::event::EventT<void (gazebo::common::UpdateInfo const&)>::Signal<gazebo::common::UpdateInfo>(gazebo::common::UpdateInfo const&)
    (_p=..., this=<optimized out>) at /tmp/gazebo/gazebo/common/Event.hh:301
#3  gazebo::event::EventT<void (gazebo::common::UpdateInfo const&)>::operator()<gazebo::common::UpdateInfo>(gazebo::common::UpdateInfo const&)
    (_p=..., this=<optimized out>) at /tmp/gazebo/gazebo/common/Event.hh:130
#4  gazebo::physics::World::Update() (this=0x5555571bb3e0)
    at /tmp/gazebo/gazebo/physics/World.cc:837
#5  0x00007ffff6bc558c in gazebo::physics::World::Step() (this=0x5555571bb3e0)
    at /tmp/gazebo/gazebo/physics/World.cc:758
#6  0x00007ffff6bc86a5 in gazebo::physics::World::RunLoop()
    (this=0x5555571bb3e0) at /tmp/gazebo/gazebo/physics/World.cc:563
#7  0x00007ffff743dd84 in  () at /lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x00007ffff6d38609 in start_thread (arg=<optimized out>)
    at pthread_create.c:477
#9  0x00007ffff727a293 in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb)
edit retag flag offensive close merge delete

Comments

Great debug information. Seems like a bug to my eyes. it would be great to find the way of triggering it in plain Gazebo not using ROS. Feel free to submit an issue to gazebo_ros_pkgs or gazebo repository.

Jose Luis Rivero gravatar imageJose Luis Rivero ( 2021-06-15 06:25:11 -0600 )edit