Quantcast
Channel: Gazebo: Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 7017

stack smashing detected combining ROS2 node an gzclient

$
0
0
Hi, I'm trying to create a simple node that listens to Gazebo transport messages and republishes them on ROS2. When I try to run the client/node I get the following error (Backtrace at the end of the message) *** stack smashing detected ***: terminated The reason I suspect Gazebo is that the stack smash only happens when I actually start the gz server. Also, while the backtrace points at the FastRTPS XML loading code, if I spin the ROS node and then start the gz server, it will crash after I start the server. I've created the following stub code to test. If you remove the allocation of std::shared_ptr bridge it will not crash. This code will only crash if the gzserver is running. #include #include #include #include #include #include #include class GazeboRealSenseBridge : public rclcpp::Node { public: GazeboRealSenseBridge() : rclcpp::Node("gazebo_realsense_bridge") { publisher = this->create_publisher("realsense_pointcloud"); } private: rclcpp::Publisher::SharedPtr publisher; }; int main(int argc, char **argv) { rclcpp::init(argc, argv); gazebo::client::setup(0, nullptr); std::shared_ptr bridge = std::make_shared(); std::map> messageTypesAndTopics = gazebo::transport::getAdvertisedTopics(); for(auto it = messageTypesAndTopics.begin(); it != messageTypesAndTopics.end(); it++) { for(auto topicIt = it->second.begin(); topicIt != it->second.end(); topicIt++) { std::cout << *topicIt << " (" << it->first << ")" << std::endl; } } gazebo::client::shutdown(); // rclcpp::spin(bridge); rclcpp::shutdown(); return 0; } # Appendix - Backtrace I think this backtrace is suspect, as it will show the same backtrace if you spin the ros node and start the server later. This code should not continuously run. Thread 1 "gazebo-realsens" received signal SIGABRT, Aborted. __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x00007ffff6178f5d in __GI_abort () at abort.c:90 #2 0x00007ffff61c128d in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff62e6a26 "*** %s ***: %s terminated\n") at ../sysdeps/posix/libc_fatal.c:181 #3 0x00007ffff6267811 in __GI___fortify_fail_abort (need_backtrace=need_backtrace@entry=false, msg=msg@entry=0x7ffff62e6a0e "stack smashing detected") at fortify_fail.c:33 #4 0x00007ffff62677d2 in __stack_chk_fail () at stack_chk_fail.c:29 #5 0x00007ffff38b4031 in eprosima::fastrtps::xmlparser::XMLParser::loadXML (filename=, Python Exception expected string or bytes-like object: root=) at /home/rosbuild/ci_scripts/ws/src/eProsima/Fast-RTPS/src/cpp/xmlparser/XMLParser.cpp:228 #6 0x00007ffff38be3fc in eprosima::fastrtps::xmlparser::XMLProfileManager::loadXMLFile (filename=) at /home/rosbuild/ci_scripts/ws/src/eProsima/Fast-RTPS/src/cpp/xmlparser/XMLProfileManager.cpp:105 #7 0x00007ffff38bee68 in eprosima::fastrtps::xmlparser::XMLProfileManager::loadDefaultXMLFile () at /home/rosbuild/ci_scripts/ws/src/eProsima/Fast-RTPS/src/cpp/xmlparser/XMLProfileManager.cpp:86 #8 0x00007ffff3814fcb in eprosima::fastrtps::Domain::getDefaultParticipantAttributes (participant_attributes=...) at /home/rosbuild/ci_scripts/ws/src/eProsima/Fast-RTPS/src/cpp/Domain.cpp:159 #9 0x00007ffff5d12e00 in rmw_create_node (name=name@entry=0x5555559b51b0 "gazebo_realsense_bridge", namespace_=namespace_@entry=0x7ffff7bccdc4 "/", domain_id=domain_id@entry=0, security_options=security_options@entry=0x7fffffffd120) at /home/rosbuild/ci_scripts/ws/src/ros2/rmw_fastrtps/rmw_fastrtps_cpp/src/rmw_node.cpp:209 #10 0x00007ffff7bc1ba5 in rcl_node_init (node=node@entry=0x5555559b5310, name=0x5555559b51b0 "gazebo_realsense_bridge", namespace_=, options=options@entry=0x7fffffffd350) at /home/rosbuild/ci_scripts/ws/src/ros2/rcl/rcl/src/rcl/node.c:274 #11 0x00007ffff794dbac in rclcpp::node_interfaces::NodeBase::NodeBase (this=0x5555559b5250, node_name="gazebo_realsense_bridge", namespace_="", context=...) at /home/rosbuild/ci_scripts/ws/src/ros2/rclcpp/rclcpp/src/rclcpp/node_interfaces/node_base.cpp:90 #12 0x00007ffff794c0d4 in rclcpp::Node::Node (this=0x5555559aaa30, node_name="gazebo_realsense_bridge", namespace_="", context=..., use_intra_process_comms=) at /home/rosbuild/ci_scripts/ws/src/ros2/rclcpp/rclcpp/src/rclcpp/node.cpp:54 #13 0x00007ffff794cb7a in rclcpp::Node::Node (this=0x5555559aaa30, node_name="gazebo_realsense_bridge", namespace_="", use_intra_process_comms=) at /home/rosbuild/ci_scripts/ws/src/ros2/rclcpp/rclcpp/src/rclcpp/node.cpp:46 #14 0x000055555555e330 in GazeboRealSenseBridge::GazeboRealSenseBridge (this=0x5555559aaa30) at /home/jesper/git/halodi/halodi_ros_ws/src/halodi-gazebo-sensors/gazebo_realsense_bridge/src/gazebo_realsense_bridge.cpp:15 #15 0x000055555556626e in __gnu_cxx::new_allocator::construct (this=0x7fffffffd777, __p=0x5555559aaa30) at /usr/include/c++/7/ext/new_allocator.h:136 #16 0x0000555555565973 in std::allocator_traits>::construct (__a=..., __p=0x5555559aaa30) at /usr/include/c++/7/bits/alloc_traits.h:475 #17 0x0000555555564b99 in std::_Sp_counted_ptr_inplace, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator) (this=0x5555559aaa20, __a=...) at /usr/include/c++/7/bits/shared_ptr_base.h:526 #18 0x0000555555563a72 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count>(std::_Sp_make_shared_tag, GazeboRealSenseBridge*, std::allocator const&) (this=0x7fffffffd8f8, __a=...) at /usr/include/c++/7/bits/shared_ptr_base.h:637 #19 0x00005555555629b2 in std::__shared_ptr::__shared_ptr>(std::_Sp_make_shared_tag, std::allocator const&) (this=0x7fffffffd8f0, __tag=..., __a=...) at /usr/include/c++/7/bits/shared_ptr_base.h:1295 #20 0x000055555556164a in std::shared_ptr::shared_ptr>(std::_Sp_make_shared_tag, std::allocator const&) (this=0x7fffffffd8f0, __tag=..., __a=...) at /usr/include/c++/7/bits/shared_ptr.h:344 #21 0x00005555555604e5 in std::allocate_shared>(std::allocator const&) (__a=...) at /usr/include/c++/7/bits/shared_ptr.h:691 #22 0x000055555555f339 in std::make_shared () at /usr/include/c++/7/bits/shared_ptr.h:707 #23 0x000055555555c465 in main (argc=1, argv=0x7fffffffda08) at /home/jesper/git/halodi/halodi_ros_ws/src/halodi-gazebo-sensors/gazebo_realsense_bridge/src/gazebo_realsense_bridge.cpp:35

Viewing all articles
Browse latest Browse all 7017

Trending Articles