Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move_group segfault when destructing node inside trajectory_execution_manager #1597

Closed
tylerjw opened this issue Oct 3, 2022 · 8 comments
Closed
Labels
bug Something isn't working

Comments

@tylerjw
Copy link
Member

tylerjw commented Oct 3, 2022

Description

 #15   Object "/opt/ros/humble/lib/moveit_ros_move_group/move_group", at 0x558f087aa794, in _start
 #14   Object "/usr/lib/x86_64-linux-gnu/libc.so.6", at 0x7fb8614ace3f, in __libc_start_main
 #13   Object "/usr/lib/x86_64-linux-gnu/libc.so.6", at 0x7fb8614acd8f, in 
 #12 | Source "./src/move_group.cpp", line 317, in ~shared_ptr
     | Source "/usr/include/c++/11/bits/shared_ptr.h", line 122, in ~__shared_ptr
     |   120:   */
     |   121:   template<typename _Tp>
     | > 122:     class shared_ptr : public __shared_ptr<_Tp>
     |   123:     {
     |   124:       template<typename... _Args>
     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 1154, in ~__shared_count
     |  1152:       __shared_ptr(const __shared_ptr&) noexcept = default;
     |  1153:       __shared_ptr& operator=(const __shared_ptr&) noexcept = default;
     | >1154:       ~__shared_ptr() = default;
     |  1155: 
     |  1156:       template<typename _Yp, typename = _Compatible<_Yp>>
       Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 705, in main [0x558f087a96cb]
         702:       ~__shared_count() noexcept
         703:       {
         704:   if (_M_pi != nullptr)
       > 705:     _M_pi->_M_release();
         706:       }
         707: 
         708:       __shared_count(const __shared_count& __r) noexcept
 #11   Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 168, in _M_release [0x558f087ab779]
         165:   if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
         166:     {
         167:             _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
       > 168:       _M_dispose();
         169:       // There must be a memory barrier between dispose() and destroy()
         170:       // to ensure that the effects of dispose() are observed in the
         171:       // thread that runs destroy().
 #10 | Source "./moveit_cpp/src/moveit_cpp.cpp", line 94, in ~shared_ptr
     | Source "/usr/include/c++/11/bits/shared_ptr.h", line 122, in ~__shared_ptr
     |   120:   */
     |   121:   template<typename _Tp>
     | > 122:     class shared_ptr : public __shared_ptr<_Tp>
     |   123:     {
     |   124:       template<typename... _Args>
     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 1154, in ~__shared_count
     |  1152:       __shared_ptr(const __shared_ptr&) noexcept = default;
     |  1153:       __shared_ptr& operator=(const __shared_ptr&) noexcept = default;
     | >1154:       ~__shared_ptr() = default;
     |  1155: 
     |  1156:       template<typename _Yp, typename = _Compatible<_Yp>>
       Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 705, in ~MoveItCpp [0x7fb861dd39c6]
         702:       ~__shared_count() noexcept
         703:       {
         704:   if (_M_pi != nullptr)
       > 705:     _M_pi->_M_release();
         706:       }
         707: 
         708:       __shared_count(const __shared_count& __r) noexcept
 #9    Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 168, in _M_release [0x7fb861dd1929]
         165:   if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
         166:     {
         167:             _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
       > 168:       _M_dispose();
         169:       // There must be a memory barrier between dispose() and destroy()
         170:       // to ensure that the effects of dispose() are observed in the
         171:       // thread that runs destroy().
 #8  | Source "./trajectory_execution_manager/src/trajectory_execution_manager.cpp", line 86, in ~shared_ptr
     | Source "/usr/include/c++/11/bits/shared_ptr.h", line 122, in ~__shared_ptr
     |   120:   */
     |   121:   template<typename _Tp>
     | > 122:     class shared_ptr : public __shared_ptr<_Tp>
     |   123:     {
     |   124:       template<typename... _Args>
     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 1154, in ~__shared_count
     |  1152:       __shared_ptr(const __shared_ptr&) noexcept = default;
     |  1153:       __shared_ptr& operator=(const __shared_ptr&) noexcept = default;
     | >1154:       ~__shared_ptr() = default;
     |  1155: 
     |  1156:       template<typename _Yp, typename = _Compatible<_Yp>>
       Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 705, in ~TrajectoryExecutionManager [0x7fb861187535]
         702:       ~__shared_count() noexcept
         703:       {
         704:   if (_M_pi != nullptr)
       > 705:     _M_pi->_M_release();
         706:       }
         707: 
         708:       __shared_count(const __shared_count& __r) noexcept
 #7    Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 168, in _M_release [0x7fb86119a2f9]
         165:   if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
         166:     {
         167:             _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
       > 168:       _M_dispose();
         169:       // There must be a memory barrier between dispose() and destroy()
         170:       // to ensure that the effects of dispose() are observed in the
         171:       // thread that runs destroy().
 #6    Source "./src/rclcpp/node.cpp", line 279, in ~Node [0x7fb861a4f5fc]
 #5  | Source "./src/rclcpp/node.cpp", line 279, in ~shared_ptr
     | Source "/usr/include/c++/11/bits/shared_ptr.h", line 122, in ~__shared_ptr
     |   120:   */
     |   121:   template<typename _Tp>
     | > 122:     class shared_ptr : public __shared_ptr<_Tp>
     |   123:     {
     |   124:       template<typename... _Args>
     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 1154, in ~__shared_count
     |  1152:       __shared_ptr(const __shared_ptr&) noexcept = default;
     |  1153:       __shared_ptr& operator=(const __shared_ptr&) noexcept = default;
     | >1154:       ~__shared_ptr() = default;
     |  1155: 
     |  1156:       template<typename _Yp, typename = _Compatible<_Yp>>
       Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 705, in ~Node [0x7fb861a4f5ce]
         702:       ~__shared_count() noexcept
         703:       {
         704:   if (_M_pi != nullptr)
       > 705:     _M_pi->_M_release();
         706:       }
         707: 
         708:       __shared_count(const __shared_count& __r) noexcept
 #4    Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 168, in _M_release [0x7fb861a2a079]
         165:   if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
         166:     {
         167:             _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
       > 168:       _M_dispose();
         169:       // There must be a memory barrier between dispose() and destroy()
         170:       // to ensure that the effects of dispose() are observed in the
         171:       // thread that runs destroy().
 #3  | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 348, in ~NodeBase
     |   346:       virtual void
     |   347:       _M_dispose() noexcept
     | > 348:       { delete _M_ptr; }
     |   349: 
     |   350:       virtual void
       Source "./src/rclcpp/node_interfaces/node_base.cpp", line 146, in _M_dispose [0x7fb861a50b29]
 #2  | Source "./src/rclcpp/node_interfaces/node_base.cpp", line 146, in ~shared_ptr
     | Source "/usr/include/c++/11/bits/shared_ptr.h", line 122, in ~__shared_ptr
     |   120:   */
     |   121:   template<typename _Tp>
     | > 122:     class shared_ptr : public __shared_ptr<_Tp>
     |   123:     {
     |   124:       template<typename... _Args>
     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 1154, in ~__shared_count
     |  1152:       __shared_ptr(const __shared_ptr&) noexcept = default;
     |  1153:       __shared_ptr& operator=(const __shared_ptr&) noexcept = default;
     | >1154:       ~__shared_ptr() = default;
     |  1155: 
     |  1156:       template<typename _Yp, typename = _Compatible<_Yp>>
       Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 705, in ~NodeBase [0x7fb861a50a70]
         702:       ~__shared_count() noexcept
         703:       {
         704:   if (_M_pi != nullptr)
       > 705:     _M_pi->_M_release();
         706:       }
         707: 
         708:       __shared_count(const __shared_count& __r) noexcept
 #1    Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 168, in _M_release [0x7fb861a2a079]
         165:   if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
         166:     {
         167:             _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
       > 168:       _M_dispose();
         169:       // There must be a memory barrier between dispose() and destroy()
         170:       // to ensure that the effects of dispose() are observed in the
         171:       // thread that runs destroy().
 #0  | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 528, in destroy<rclcpp::CallbackGroup>
     |   526:       _M_dispose() noexcept
     |   527:       {
     | > 528:   allocator_traits<_Alloc>::destroy(_M_impl._M_alloc(), _M_ptr());
     |   529:       }
     | Source "/usr/include/c++/11/bits/alloc_traits.h", line 535, in destroy<rclcpp::CallbackGroup>
     |   533:   {
     |   534: #if __cplusplus <= 201703L
     | > 535:     __a.destroy(__p);
     |   536: #else
     |   537:     std::destroy_at(__p);
     | Source "/usr/include/c++/11/ext/new_allocator.h", line 168, in ~CallbackGroup
     |   166:   destroy(_Up* __p)
     |   167:   noexcept(std::is_nothrow_destructible<_Up>::value)
     | > 168:   { __p->~_Up(); }
     |   169: #else
     |   170:       // _GLIBCXX_RESOLVE_LIB_DEFECTS
     | Source "./include/rclcpp/callback_group.hpp", line 49, in ~vector
     | Source "/usr/include/c++/11/bits/stl_vector.h", line 680, in _Destroy<std::weak_ptr<rclcpp::ClientBase>*, std::weak_ptr<rclcpp::ClientBase> >
     |   678:       ~vector() _GLIBCXX_NOEXCEPT
     |   679:       {
     | > 680:   std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
     |   681:           _M_get_Tp_allocator());
     |   682:   _GLIBCXX_ASAN_ANNOTATE_BEFORE_DEALLOC;
     | Source "/usr/include/c++/11/bits/alloc_traits.h", line 854, in _Destroy<std::weak_ptr<rclcpp::ClientBase>*>
     |   852:        allocator<_Tp>&)
     |   853:     {
     | > 854:       _Destroy(__first, __last);
     |   855:     }
     | Source "/usr/include/c++/11/bits/stl_construct.h", line 196, in __destroy<std::weak_ptr<rclcpp::ClientBase>*>
     |   194: #endif
     |   195:       std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
     | > 196:   __destroy(__first, __last);
     |   197:     }
     | Source "/usr/include/c++/11/bits/stl_construct.h", line 163, in _Destroy<std::weak_ptr<rclcpp::ClientBase> >
     |   161:   {
     |   162:     for (; __first != __last; ++__first)
     | > 163:       std::_Destroy(std::__addressof(*__first));
     |   164:   }
     |   165:     };
     | Source "/usr/include/c++/11/bits/stl_construct.h", line 151, in ~weak_ptr
     |   149:       std::destroy_at(__pointer);
     |   150: #else
     | > 151:       __pointer->~_Tp();
     |   152: #endif
     |   153:     }
     | Source "/usr/include/c++/11/bits/shared_ptr.h", line 686, in ~__weak_ptr
     |   684:    */
     |   685:   template<typename _Tp>
     | > 686:     class weak_ptr : public __weak_ptr<_Tp>
     |   687:     {
     |   688:       template<typename _Arg>
     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 1610, in ~__weak_count
     |  1608:       __weak_ptr(const __weak_ptr&) noexcept = default;
     |  1609: 
     | >1610:       ~__weak_ptr() = default;
     |  1611: 
     |  1612:       // The "obvious" converting constructor implementation:
     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 798, in _M_weak_release
     |   796:       {
     |   797:   if (_M_pi != nullptr)
     | > 798:     _M_pi->_M_weak_release();
     |   799:       }
     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 161, in _M_release
     |   160:       void
     | > 161:       _M_release() noexcept
     |   162:       {
     |   163:         // Be race-detector-friendly.  For more info see bits/c++config.
       Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 184, in _M_dispose [0x7fb861a4fb21]
         181:                    -1) == 1)
         182:               {
         183:                 _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
       > 184:           _M_destroy();
         185:               }
         186:     }
         187:       }
 Segmentation fault (Address not mapped to object [0x7fb844621c90])
@tylerjw tylerjw added the bug Something isn't working label Oct 3, 2022
@tylerjw tylerjw changed the title move_group segfault on shutdown move_group segfault when destructing node inside trajectory_execution_manager Oct 3, 2022
@timonegk
Copy link
Contributor

I'm facing another segmentation fault that seems to be only in version 2.5.3-1jammy.20220914.xxxxx. The previous version (2.5.3-1jammy.20220815.xxxxx works fine). Maybe a rebuild of the packages could fix the issue?

[move_group-1] Stack trace (most recent call last):
[move_group-1] #20   Object "", at 0xffffffffffffffff, in 
[move_group-1] #19   Object "/opt/ros/rolling/lib/moveit_ros_move_group/move_group", at 0x560929291794, in 
[move_group-1] #18   Source "../csu/libc-start.c", line 392, in __libc_start_main_impl [0x7ffa37827e3f]
[move_group-1] #17   Source "../sysdeps/nptl/libc_start_call_main.h", line 58, in __libc_start_call_main [0x7ffa37827d8f]
[move_group-1] #16   Object "/opt/ros/rolling/lib/moveit_ros_move_group/move_group", at 0x560929290332, in 
[move_group-1] #15   Object "/opt/ros/rolling/lib/libmoveit_cpp.so.2.5.3", at 0x7ffa38171014, in moveit_cpp::MoveItCpp::MoveItCpp(std::shared_ptr<rclcpp::Node> const&, moveit_cpp::MoveItCpp::Options const&)
[move_group-1] #14   Object "/opt/ros/rolling/lib/libmoveit_cpp.so.2.5.3", at 0x7ffa3816e9cb, in moveit_cpp::MoveItCpp::loadPlanningSceneMonitor(moveit_cpp::MoveItCpp::PlanningSceneMonitorOptions const&)
[move_group-1] #13   Object "/opt/ros/rolling/lib/libmoveit_planning_scene_monitor.so.2.5.3", at 0x7ffa3808fcaa, in planning_scene_monitor::PlanningSceneMonitor::PlanningSceneMonitor(std::shared_ptr<rclcpp::Node> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
[move_group-1] #12   Object "/opt/ros/rolling/lib/libmoveit_planning_scene_monitor.so.2.5.3", at 0x7ffa3808fc1a, in planning_scene_monitor::PlanningSceneMonitor::PlanningSceneMonitor(std::shared_ptr<rclcpp::Node> const&, std::shared_ptr<planning_scene::PlanningScene> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
[move_group-1] #11   Object "/opt/ros/rolling/lib/libmoveit_planning_scene_monitor.so.2.5.3", at 0x7ffa3808f7ac, in planning_scene_monitor::PlanningSceneMonitor::PlanningSceneMonitor(std::shared_ptr<rclcpp::Node> const&, std::shared_ptr<planning_scene::PlanningScene> const&, std::shared_ptr<robot_model_loader::RobotModelLoader> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
[move_group-1] #10   Object "/opt/ros/rolling/lib/libtf2_ros.so", at 0x7ffa37f4790e, in tf2_ros::TransformListener::TransformListener(tf2::BufferCore&, bool)
[move_group-1] #9    Object "/opt/ros/rolling/lib/librclcpp.so", at 0x7ffa37dc9e67, in rclcpp::executors::EventsExecutor::add_callback_group(std::shared_ptr<rclcpp::CallbackGroup>, std::shared_ptr<rclcpp::node_interfaces::NodeBaseInterface>, bool)
[move_group-1] #8    Object "/opt/ros/rolling/lib/librclcpp.so", at 0x7ffa37dc9d84, in rclcpp::executors::EventsExecutorEntitiesCollector::add_callback_group(std::shared_ptr<rclcpp::CallbackGroup>, std::shared_ptr<rclcpp::node_interfaces::NodeBaseInterface>)
[move_group-1] #7    Object "/opt/ros/rolling/lib/librclcpp.so", at 0x7ffa37dc9917, in rclcpp::executors::EventsExecutorEntitiesCollector::add_callback_group(std::shared_ptr<rclcpp::CallbackGroup>, std::shared_ptr<rclcpp::node_interfaces::NodeBaseInterface>, std::map<std::weak_ptr<rclcpp::CallbackGroup>, std::weak_ptr<rclcpp::node_interfaces::NodeBaseInterface>, std::owner_less<std::weak_ptr<rclcpp::CallbackGroup> >, std::allocator<std::pair<std::weak_ptr<rclcpp::CallbackGroup> const, std::weak_ptr<rclcpp::node_interfaces::NodeBaseInterface> > > >&)
[move_group-1] #6    Object "/opt/ros/rolling/lib/librclcpp.so", at 0x7ffa37dc8f07, in rclcpp::executors::EventsExecutorEntitiesCollector::set_callback_group_entities_callbacks(std::shared_ptr<rclcpp::CallbackGroup>)
[move_group-1] #5    Object "/opt/ros/rolling/lib/libtf2_ros.so", at 0x7ffa37f4170e, in 
[move_group-1] #4    Object "/opt/ros/rolling/lib/librclcpp.so", at 0x7ffa37e30f33, in rclcpp::QOSEventHandlerBase::set_on_new_event_callback(void (*)(void const*, unsigned long), void const*)
[move_group-1] #3    Object "/opt/ros/rolling/lib/librmw_fastrtps_shared_cpp.so", at 0x7ffa342cb21c, in rmw_fastrtps_shared_cpp::__rmw_event_set_callback(rmw_event_s*, void (*)(void const*, unsigned long), void const*)
[move_group-1] #2    Object "/opt/ros/rolling/lib/librmw_fastrtps_shared_cpp.so", at 0x7ffa342c6f1b, in SubListener::set_on_new_event_callback(rmw_event_type_e, void const*, void (*)(void const*, unsigned long))
[move_group-1] #1    Object "/opt/ros/rolling/lib/libmoveit_planning_scene_monitor.so.2.5.3", at 0x7ffa380a1198, in void rclcpp::detail::cpp_callback_trampoline<void const*, unsigned long, void>(void const*, unsigned long)
[move_group-1] #0    Object "/opt/ros/rolling/lib/librclcpp.so", at 0x7ffa37dc35c8, in 
[move_group-1] Segmentation fault (Address not mapped to object [(nil)])

@tylerjw
Copy link
Member Author

tylerjw commented Oct 19, 2022

@timonegk can you reproduce this error with debug symbols so we can get more detail out of the stack trace to see if it is the same segfault or a different one?

If you are using moveit from apt you can install the packages:

ros-rolling-rclcpp-dbgsym
ros-rolling-moveit-ros-move-group-dbgsym
ros-rolling-moveit-ros-planning-dbgsym

Then when the segfault happens you should get a stack trace that includes where in the code it is failing.

@timonegk
Copy link
Contributor

I am unfortunately no longer able to reproduce my issue, I'm getting a different error now. I will report back when I know more.

@timonegk
Copy link
Contributor

timonegk commented Feb 7, 2023

The issue is back, here is the stack trace:

[move_group-1] Warning: class_loader.ClassLoader: SEVERE WARNING!!! Attempting to unload library while objects created by this loader exist in the heap! You should delete your objects before attempting to unload the library or destroying the ClassLoader. The library will NOT be unloaded.
[move_group-1]          at line 127 in ./src/class_loader.cpp
[move_group-1] Stack trace (most recent call last):
[move_group-1] #11   Object "", at 0xffffffffffffffff, in 
[move_group-1] #10   Object "/opt/ros/rolling/lib/moveit_ros_move_group/move_group", at 0x55c6da1697a4, in _start
[move_group-1] #9    Object "/usr/lib/x86_64-linux-gnu/libc.so.6", at 0x7f2d3d19be3f, in __libc_start_main
[move_group-1] #8    Object "/usr/lib/x86_64-linux-gnu/libc.so.6", at 0x7f2d3d19bd8f, in 
[move_group-1] #7  | Source "./src/move_group.cpp", line 317, in ~shared_ptr
[move_group-1]     | Source "/usr/include/c++/11/bits/shared_ptr.h", line 122, in ~__shared_ptr
[move_group-1]     |   120:   */
[move_group-1]     |   121:   template<typename _Tp>
[move_group-1]     | > 122:     class shared_ptr : public __shared_ptr<_Tp>
[move_group-1]     |   123:     {
[move_group-1]     |   124:       template<typename... _Args>
[move_group-1]     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 1154, in ~__shared_count
[move_group-1]     |  1152:       __shared_ptr(const __shared_ptr&) noexcept = default;
[move_group-1]     |  1153:       __shared_ptr& operator=(const __shared_ptr&) noexcept = default;
[move_group-1]     | >1154:       ~__shared_ptr() = default;
[move_group-1]     |  1155: 
[move_group-1]     |  1156:       template<typename _Yp, typename = _Compatible<_Yp>>
[move_group-1]       Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 705, in main [0x55c6da168711]
[move_group-1]         702:       ~__shared_count() noexcept
[move_group-1]         703:       {
[move_group-1]         704: 	if (_M_pi != nullptr)
[move_group-1]       > 705: 	  _M_pi->_M_release();
[move_group-1]         706:       }
[move_group-1]         707: 
[move_group-1]         708:       __shared_count(const __shared_count& __r) noexcept
[move_group-1] #6    Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 168, in _M_release [0x55c6da16a739]
[move_group-1]         165: 	if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
[move_group-1]         166: 	  {
[move_group-1]         167:             _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
[move_group-1]       > 168: 	    _M_dispose();
[move_group-1]         169: 	    // There must be a memory barrier between dispose() and destroy()
[move_group-1]         170: 	    // to ensure that the effects of dispose() are observed in the
[move_group-1]         171: 	    // thread that runs destroy().
[move_group-1] #5  | Source "./src/rclcpp/node.cpp", line 280, in ~shared_ptr
[move_group-1]     | Source "/usr/include/c++/11/bits/shared_ptr.h", line 122, in ~__shared_ptr
[move_group-1]     |   120:   */
[move_group-1]     |   121:   template<typename _Tp>
[move_group-1]     | > 122:     class shared_ptr : public __shared_ptr<_Tp>
[move_group-1]     |   123:     {
[move_group-1]     |   124:       template<typename... _Args>
[move_group-1]     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 1154, in ~__shared_count
[move_group-1]     |  1152:       __shared_ptr(const __shared_ptr&) noexcept = default;
[move_group-1]     |  1153:       __shared_ptr& operator=(const __shared_ptr&) noexcept = default;
[move_group-1]     | >1154:       ~__shared_ptr() = default;
[move_group-1]     |  1155: 
[move_group-1]     |  1156:       template<typename _Yp, typename = _Compatible<_Yp>>
[move_group-1]       Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 705, in ~Node [0x7f2d3d74868e]
[move_group-1]         702:       ~__shared_count() noexcept
[move_group-1]         703:       {
[move_group-1]         704: 	if (_M_pi != nullptr)
[move_group-1]       > 705: 	  _M_pi->_M_release();
[move_group-1]         706:       }
[move_group-1]         707: 
[move_group-1]         708:       __shared_count(const __shared_count& __r) noexcept
[move_group-1] #4    Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 168, in _M_release [0x7f2d3d723cc9]
[move_group-1]         165: 	if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
[move_group-1]         166: 	  {
[move_group-1]         167:             _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
[move_group-1]       > 168: 	    _M_dispose();
[move_group-1]         169: 	    // There must be a memory barrier between dispose() and destroy()
[move_group-1]         170: 	    // to ensure that the effects of dispose() are observed in the
[move_group-1]         171: 	    // thread that runs destroy().
[move_group-1] #3  | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 348, in ~NodeBase
[move_group-1]     |   346:       virtual void
[move_group-1]     |   347:       _M_dispose() noexcept
[move_group-1]     | > 348:       { delete _M_ptr; }
[move_group-1]     |   349: 
[move_group-1]     |   350:       virtual void
[move_group-1]       Source "./src/rclcpp/node_interfaces/node_base.cpp", line 150, in _M_dispose [0x7f2d3d751dd9]
[move_group-1] #2  | Source "./src/rclcpp/node_interfaces/node_base.cpp", line 150, in ~shared_ptr
[move_group-1]     | Source "/usr/include/c++/11/bits/shared_ptr.h", line 122, in ~__shared_ptr
[move_group-1]     |   120:   */
[move_group-1]     |   121:   template<typename _Tp>
[move_group-1]     | > 122:     class shared_ptr : public __shared_ptr<_Tp>
[move_group-1]     |   123:     {
[move_group-1]     |   124:       template<typename... _Args>
[move_group-1]     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 1154, in ~__shared_count
[move_group-1]     |  1152:       __shared_ptr(const __shared_ptr&) noexcept = default;
[move_group-1]     |  1153:       __shared_ptr& operator=(const __shared_ptr&) noexcept = default;
[move_group-1]     | >1154:       ~__shared_ptr() = default;
[move_group-1]     |  1155: 
[move_group-1]     |  1156:       template<typename _Yp, typename = _Compatible<_Yp>>
[move_group-1]       Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 705, in ~NodeBase [0x7f2d3d751d20]
[move_group-1]         702:       ~__shared_count() noexcept
[move_group-1]         703:       {
[move_group-1]         704: 	if (_M_pi != nullptr)
[move_group-1]       > 705: 	  _M_pi->_M_release();
[move_group-1]         706:       }
[move_group-1]         707: 
[move_group-1]         708:       __shared_count(const __shared_count& __r) noexcept
[move_group-1] #1    Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 168, in _M_release [0x7f2d3d723cc9]
[move_group-1]         165: 	if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
[move_group-1]         166: 	  {
[move_group-1]         167:             _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
[move_group-1]       > 168: 	    _M_dispose();
[move_group-1]         169: 	    // There must be a memory barrier between dispose() and destroy()
[move_group-1]         170: 	    // to ensure that the effects of dispose() are observed in the
[move_group-1]         171: 	    // thread that runs destroy().
[move_group-1] #0  | Source "./src/rclcpp/callback_group.cpp", line 43, in ~vector
[move_group-1]     | Source "/usr/include/c++/11/bits/stl_vector.h", line 680, in _Destroy<std::weak_ptr<rclcpp::Waitable>*, std::weak_ptr<rclcpp::Waitable> >
[move_group-1]     |   678:       ~vector() _GLIBCXX_NOEXCEPT
[move_group-1]     |   679:       {
[move_group-1]     | > 680: 	std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
[move_group-1]     |   681: 		      _M_get_Tp_allocator());
[move_group-1]     |   682: 	_GLIBCXX_ASAN_ANNOTATE_BEFORE_DEALLOC;
[move_group-1]     | Source "/usr/include/c++/11/bits/alloc_traits.h", line 848, in _Destroy<std::weak_ptr<rclcpp::Waitable>*>
[move_group-1]     |   846: 	     allocator<_Tp>&)
[move_group-1]     |   847:     {
[move_group-1]     | > 848:       _Destroy(__first, __last);
[move_group-1]     |   849:     }
[move_group-1]     | Source "/usr/include/c++/11/bits/stl_construct.h", line 196, in __destroy<std::weak_ptr<rclcpp::Waitable>*>
[move_group-1]     |   194: #endif
[move_group-1]     |   195:       std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
[move_group-1]     | > 196: 	__destroy(__first, __last);
[move_group-1]     |   197:     }
[move_group-1]     | Source "/usr/include/c++/11/bits/stl_construct.h", line 163, in _Destroy<std::weak_ptr<rclcpp::Waitable> >
[move_group-1]     |   161: 	{
[move_group-1]     |   162: 	  for (; __first != __last; ++__first)
[move_group-1]     | > 163: 	    std::_Destroy(std::__addressof(*__first));
[move_group-1]     |   164: 	}
[move_group-1]     |   165:     };
[move_group-1]     | Source "/usr/include/c++/11/bits/stl_construct.h", line 151, in ~weak_ptr
[move_group-1]     |   149:       std::destroy_at(__pointer);
[move_group-1]     |   150: #else
[move_group-1]     | > 151:       __pointer->~_Tp();
[move_group-1]     |   152: #endif
[move_group-1]     |   153:     }
[move_group-1]     | Source "/usr/include/c++/11/bits/shared_ptr.h", line 686, in ~__weak_ptr
[move_group-1]     |   684:    */
[move_group-1]     |   685:   template<typename _Tp>
[move_group-1]     | > 686:     class weak_ptr : public __weak_ptr<_Tp>
[move_group-1]     |   687:     {
[move_group-1]     |   688:       template<typename _Arg>
[move_group-1]     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 1610, in ~__weak_count
[move_group-1]     |  1608:       __weak_ptr(const __weak_ptr&) noexcept = default;
[move_group-1]     |  1609: 
[move_group-1]     | >1610:       ~__weak_ptr() = default;
[move_group-1]     |  1611: 
[move_group-1]     |  1612:       // The "obvious" converting constructor implementation:
[move_group-1]     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 798, in _M_weak_release
[move_group-1]     |   796:       {
[move_group-1]     |   797: 	if (_M_pi != nullptr)
[move_group-1]     | > 798: 	  _M_pi->_M_weak_release();
[move_group-1]     |   799:       }
[move_group-1]     | Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 161, in _M_release
[move_group-1]     |   160:       void
[move_group-1]     | > 161:       _M_release() noexcept
[move_group-1]     |   162:       {
[move_group-1]     |   163:         // Be race-detector-friendly.  For more info see bits/c++config.
[move_group-1]       Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 184, in ~CallbackGroup [0x7f2d3d728a61]
[move_group-1]         181: 						       -1) == 1)
[move_group-1]         182:               {
[move_group-1]         183:                 _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
[move_group-1]       > 184: 	        _M_destroy();
[move_group-1]         185:               }
[move_group-1]         186: 	  }
[move_group-1]         187:       }
[move_group-1] Segmentation fault (Address not mapped to object [0x7f2d2d0c2e28])

Looks at least similar to yours, however there is no trajectory_execution_manager. And I think my traceback from october was a different one. This time I reproduced the issue in a clean docker container with the packages ros-rolling-moveit-resources-pr2-description ros-rolling-moveit-ros-move-group ros-rolling-moveit-planners-ompl ros-roling-moveit-simple-controller-manager installed and the following lanuch file:

import os

from ament_index_python import get_package_share_directory
from launch import LaunchDescription
from launch.actions import OpaqueFunction
from launch_ros.actions import Node

def load_file(package_name, file_path):
    package_path = get_package_share_directory(package_name)
    absolute_file_path = os.path.join(package_path, file_path)

    try:
        with open(absolute_file_path, "r") as file:
            return file.read()
    except EnvironmentError:  # parent of IOError, OSError *and* WindowsError where available
        return None

def launch_setup(context, *args, **kwargs):
    robot_description = load_file("moveit_resources_pr2_description", "urdf/robot.xml")
    robot_description_semantic_config = load_file("moveit_resources_pr2_description", "srdf/robot.xml")

    # Trajectory Execution Functionality
    moveit_controllers = {
        "moveit_controller_manager": "moveit_simple_controller_manager/MoveItSimpleControllerManager",
    }

    move_group_node = Node(package='moveit_ros_move_group',
                           executable='move_group',
                           parameters=[{
                               'robot_description': robot_description,
                               'robot_description_semantic': robot_description_semantic_config,
                           },
                           moveit_controllers,
                           ],
                           arguments=['--ros-args', '--log-level', 'WARN'],
                           )
    return [move_group_node]


def generate_launch_description():
    return LaunchDescription([OpaqueFunction(function=launch_setup)])

@henningkayser
Copy link
Member

isn't this fixed with #2001

@JafarAbdi
Copy link
Contributor

If I recall correctly #1918 fixed this issue, @samialperen do you mind testing it?

@samialperen
Copy link
Contributor

@JafarAbdi tested #2001 and all good. Thanks.

@timonegk
Copy link
Contributor

This issue still exists for me with version 2.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants