-
Notifications
You must be signed in to change notification settings - Fork 114
Description
Hi all, thanks for the implementation of the Orbbec driver! We are using rclcpp composition to dynamically load and unload the orbbec_camera::OBCameraNodeDriver that you provide (note that this refers to v2-main)
Issue
It happened more or less by accident that I loaded the camera node while I didn't have the camera plugged it. If I then unload the component again, the destructor of the ob::Context produces a segfault. Here are the logs:
[INFO] [1749792909.121660723] [StateEventHandler]: Loading component orbbec_camera::OBCameraNodeDriver
[INFO] [1749792909.203013449] [orbbec_camera]: setUvcBackendType:libuvc
[INFO] [1749792910.205317114] [orbbec_camera]: queryDevice :No Device found, using usb event to trigger OBCameraNodeDriver::onDeviceConnected
... [ here unloading ] ...
Received signal: 11
Log crash stack trace to Log/orbbec_camera_crash_stack_trace_2025_06_13_05_35_12.log
Failed to delete datawriter, at ./src/publisher.cpp:45 during '__function__'
[ros2run]: Process exited with failure 11
And the content of the Log file
Received signal: 11
Stack trace (most recent call last) in thread 157:
#12 Object "[0xffffffffffffffff]", at 0xffffffffffffffff, in
#11 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7019b7f33c3b, in
#10 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7019b7ea6aa3, in
#9 Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7019b821fdb3, in
#8 Object "/ws/install/orbbec_camera/lib/libOrbbecSDK.so.2", at 0x70191966ffbc, in std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Bind<void (*(std::shared_ptr<ObLogIntvlRecord>, unsigned long, spdlog::source_loc, spdlog::level::level_enum, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char*, unsigned short))(std::shared_ptr<ObLogIntvlRecord>, unsigned long, spdlog::source_loc, spdlog::level::level_enum, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char*&, unsigned short&)> > > >::_M_run()
#7 Object "/ws/install/orbbec_camera/lib/libOrbbecSDK.so.2", at 0x70191967904d, in
#6 Object "/ws/install/orbbec_camera/lib/libOrbbecSDK.so.2", at 0x701919503c8e, in
#5 Object "/ws/install/orbbec_camera/lib/libOrbbecSDK.so.2", at 0x701919aba328, in
#4 Object "/ws/install/orbbec_camera/lib/libOrbbecSDK.so.2", at 0x701919ab9fce, in
#3 Object "/ws/install/orbbec_camera/lib/libOrbbecSDK.so.2", at 0x701919aabd48, in
#2 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7019b7f9575d, in
#1 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7019b7e4f32f, in
#0 Object "/ws/install/orbbec_camera/lib/liborbbec_camera.so", at 0x701938670463, in signalHandler(int)
Cause
I can almost say for sure that the problem comes from here since commenting out this line solves the issue in the sense that there is no segfault. However, it would certainly be preferable to properly clean up the context. Since the SDK is provided as a shared library, I can't investigate further.
I hope it's possible to replicate this and fix in a future version of the SDK. Thanks!