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

Segmentation fault if sensor is unpowered on start-up #410

Closed
tombrodie opened this issue Dec 11, 2024 · 1 comment
Closed

Segmentation fault if sensor is unpowered on start-up #410

tombrodie opened this issue Dec 11, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@tombrodie
Copy link
Contributor

tombrodie commented Dec 11, 2024

Describe the bug
When the Ouster is not powered and the code is started, a segmentation fault occurs.

To Reproduce

  1. Checkout the master branch on c6f66d2c439aa27a6018a09a5e5b02fa222b52db
  2. Ensure the sensor is not on
  3. Run the Ouster driver: <include file="$(find ouster_ros)/launch/sensor.launch">

Debugging information
Journal logs:

kernel: nodelet[1922]: segfault at 0 ip 00007f42c4649ae8 sp 00007ffe1f8638e0 error 4 in libouster_ros_nodelets.so[7f42c463a000+7a000]

Stack trace:

Core was generated by `/opt/ros/noetic/lib/nodelet/nodelet manager __name:=os_nodelet_mgr __log:=/var/'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fac5ef63ae8 in ouster_ros::OusterSensor::stop_sensor_connection_thread() () from /opt/ros/noetic/lib//libouster_ros_nodelets.so
[Current thread is 1 (Thread 0x7fac7286d780 (LWP 68))]
(gdb) bt
#0  0x00007fac5ef63ae8 in ouster_ros::OusterSensor::stop_sensor_connection_thread() () from /opt/ros/noetic/lib//libouster_ros_nodelets.so
#1  0x00007fac5ef6482d in ouster_ros::OusterSensor::~OusterSensor() () from /opt/ros/noetic/lib//libouster_ros_nodelets.so
#2  0x00007fac5ef64e8d in ouster_ros::OusterSensor::~OusterSensor() () from /opt/ros/noetic/lib//libouster_ros_nodelets.so
#3  0x00007fac75dd4567 in void class_loader::ClassLoader::onPluginDeletion<nodelet::Nodelet>(nodelet::Nodelet*) () from /opt/ros/noetic/lib/libnodeletlib.so
#4  0x00007fac75dcb999 in boost::detail::sp_counted_impl_pd<nodelet::Nodelet*, boost::_bi::bind_t<void, boost::_mfi::mf1<void, class_loader::ClassLoader, nodelet::Nodelet*>, boost::_bi::list2<boost::_bi::value<class_loader::ClassLoader*>, boost::arg<1> > > >::dispose() ()
   from /opt/ros/noetic/lib/libnodeletlib.so
#5  0x000055831b95e07a in boost::detail::sp_counted_base::release() ()
#6  0x00007fac75dca3bf in nodelet::Loader::unload(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /opt/ros/noetic/lib/libnodeletlib.so
#7  0x00007fac75dda13d in nodelet::LoaderROS::unload(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /opt/ros/noetic/lib/libnodeletlib.so
#8  0x00007fac75d3de41 in bond::Bond::flushPendingCallbacks() () from /opt/ros/noetic/lib/libbondcpp.so
#9  0x00007fac75d3df9d in bond::Bond::onConnectTimeout() () from /opt/ros/noetic/lib/libbondcpp.so
#10 0x00007fac75ca8dc1 in ros::TimerManager<ros::SteadyTime, ros::WallDuration, ros::SteadyTimerEvent>::TimerQueueCallback::call() () from /opt/ros/noetic/lib/libroscpp.so
#11 0x00007fac75c76162 in ros::CallbackQueue::callOneCB(ros::CallbackQueue::TLS*) () from /opt/ros/noetic/lib/libroscpp.so
#12 0x00007fac75c77873 in ros::CallbackQueue::callAvailable(ros::WallDuration) () from /opt/ros/noetic/lib/libroscpp.so
#13 0x00007fac75ccb02f in ros::SingleThreadedSpinner::spin(ros::CallbackQueue*) () from /opt/ros/noetic/lib/libroscpp.so
#14 0x00007fac75cb324f in ros::spin() () from /opt/ros/noetic/lib/libroscpp.so
#15 0x000055831b95c234 in main ()

My thought:
The start() function returns before start_sensor_connection_thread() is called. Thus, when stop_sensor_connection_thread() is called in the destructor, the std::unique_ptr that is sensor_connection_thread is not initialised, and remains null. A check for a nullptr should be performed in stop_sensor_connection_thread() before checking sensor_connection_thread->joinable().

Platform:

  • Ouster Sensor? OS1-32
  • Ouster Firmware Version? 3.1
  • ROS version/distro? Noetic
  • Operating System? Linux Ubuntu 20.4
  • Machine Architecture? x86
  • git commit hash c6f66d2c439aa27a6018a09a5e5b02fa222b52db
@tombrodie tombrodie added the bug Something isn't working label Dec 11, 2024
@Samahu Samahu self-assigned this Dec 11, 2024
@Samahu
Copy link
Contributor

Samahu commented Dec 19, 2024

Resolved by #411

@Samahu Samahu closed this as completed Dec 19, 2024
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

2 participants