Open
Description
How to reproduce the bug
Terminal 1
roscore
Terminal 2
Download the rosbag and play
rosbag play -l -s 0 -u 10 2024-12-20-09-36-52.bag
Terminal 3
Launch the file below
<?xml version="1.0" encoding="utf-8"?>
<launch>
<!-- IMAGE related nodes -->
<node name="nodelet_manager"
pkg="nodelet" type="nodelet"
args="manager" output="screen"
launch-prefix="gdb --args"
/>
<!-- <arg name="" /> -->
<!-- Template matching and detect trashbin pose -->
<!-- publish frontleft camera SIFT -->
<node name="frontleft_camera_imagesift"
pkg="nodelet" type="nodelet"
args="load imagesift/ImageSift nodelet_manager">
<remap from="image" to="/spot/camera/frontleft/image"/>
<remap from="camera_info" to="/spot/camera/frontleft/camera_info" />
<remap from="ImageFeature0D" to="/spot/camera/frontleft/ImageFeature0D" />
</node>
<!-- publish frontright camera SIFT -->
<node name="frontright_camera_imagesift"
pkg="nodelet" type="nodelet"
args="load imagesift/ImageSift nodelet_manager">
<remap from="image" to="/spot/camera/frontright/image"/>
<remap from="camera_info" to="/spot/camera/frontright/camera_info" />
<remap from="ImageFeature0D" to="/spot/camera/frontright/ImageFeature0D" />
</node>
</launch>
Terminal 4
rostopic hz /spot/camera/frontleft/ImageFeature0D
Terminal 5
rostopic hz /spot/camera/frontright/ImageFeature0D
then segfaults.
GDB output with -DCMAKE_BUILD_TYPE=Debug
and
❯ git diff
diff --git a/imagesift/CMakeLists.txt b/imagesift/CMakeLists.txt
index 0a6f349a..97b9b3c5 100644
--- a/imagesift/CMakeLists.txt
+++ b/imagesift/CMakeLists.txt
@@ -72,7 +72,7 @@ jsk_nodelet(src/imagesift.cpp
add_library(lib_${PROJECT_NAME} SHARED ${nodelet_sources})
set_target_properties(lib_${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
-add_definitions("-O2 -g")
+add_definitions("-O0 -g")
include_directories(include ${catkin_INCLUDE_DIRS})
target_link_libraries(lib_${PROJECT_NAME} ${catkin_LIBRARIES} ${OpenCV_LIBS})
─── Output/messages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Thread 7 "nodelet" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff1a0f700 (LWP 259439)]
0x00007ffff7f1bc0d in OctaveKeypoints (pimage=pimage@entry=0x7fffec0028a0, phalfimage=phalfimage@entry=0x7ffff1a0e3e0, fscale=fscale@entry=0.5, prevkeypts=prevkeypts@entry=0x0) at /home/obinata/ros/catkin_ws/build/libsiftfast/libsiftfast_svn/libsiftfast.cpp:513
513 s_imdiff[i-1]->rows = rows; s_imdiff[i-1]->cols = cols; s_imdiff[i-1]->stride = stride;
─── Assembly ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
0x00007ffff7f1bbf1 OctaveKeypoints(Image, Image*, float, Keypoint)+241 mov 0x47d0(%rip),%rdx # 0x7ffff7f203c8 <_ZL8s_imdiff>
0x00007ffff7f1bbf8 OctaveKeypoints(Image, Image*, float, Keypoint)+248 mov -0x8(%rdx,%rbx,1),%rdi
0x00007ffff7f1bbfd OctaveKeypoints(Image, Image*, float, Keypoint)+253 mov 0x47cc(%rip),%rdx # 0x7ffff7f203d0 <_ZL8s_imgaus>
0x00007ffff7f1bc04 OctaveKeypoints(Image, Image*, float, Keypoint)+260 mov (%rdx,%rbx,1),%r8
0x00007ffff7f1bc08 OctaveKeypoints(Image, Image*, float, Keypoint)+264 mov -0x8(%rdx,%rbx,1),%rsi
0x00007ffff7f1bc0d OctaveKeypoints(Image, Image*, float, Keypoint)+269 mov %r13d,(%rdi)
0x00007ffff7f1bc10 OctaveKeypoints(Image, Image*, float, Keypoint)+272 mov %r12d,0x4(%rdi)
0x00007ffff7f1bc14 OctaveKeypoints(Image, Image*, float, Keypoint)+276 mov %ebp,0x10(%rdi)
0x00007ffff7f1bc17 OctaveKeypoints(Image, Image*, float, Keypoint)+279 mov %r8,%rdx
0x00007ffff7f1bc1a OctaveKeypoints(Image, Image*, float, Keypoint)+282 callq 0x7ffff7f16570 <SubtractImage@plt>
─── Breakpoints ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Expressions ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── History ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Memory ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Registers ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
rax 0x0000000000000000 rbx 0x0000000000000010 rcx 0x00007fffd813840c rdx 0x00007fffb400d950 rsi 0x0000000000000000 rdi 0x0000000000000000 rbp 0x00000000000004fe rsp 0x00007ffff1a0e370
r8 0x6e696b7400000000 r9 0x00000000000003ba r10 0x0000000000000000 r11 0x0000000000000246 r12 0x00000000000004fe r13 0x00000000000003be r14 0x0000000000000000 r15 0x0000000000000003
rip 0x00007ffff7f1bc0d eflags [ IF RF ] cs 0x00000033 ss 0x0000002b ds 0x00000000 es 0x00000000 fs 0x00000000 gs 0x00000000
─── Source ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
508 for(int i = 1; i < s_params.Scales+3; ++i) {
509
510 s_imgaus[i]->rows = rows; s_imgaus[i]->cols = cols; s_imgaus[i]->stride = stride;
511 GaussianBlur(s_imgaus[i], s_imgaus[i-1], fincsigma * sigma);
512
513 s_imdiff[i-1]->rows = rows; s_imdiff[i-1]->cols = cols; s_imdiff[i-1]->stride = stride;
514 SubtractImage(s_imdiff[i-1],s_imgaus[i-1],s_imgaus[i]);
515
516 sigma *= fwidth;
517 }
─── Stack ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[0] from 0x00007ffff7f1bc0d in OctaveKeypoints(Image, Image*, float, Keypoint)+269 at /home/obinata/ros/catkin_ws/build/libsiftfast/libsiftfast_svn/libsiftfast.cpp:513
[1] from 0x00007ffff7f1be94 in GetKeypointsInternal(ImageSt*)+484 at /home/obinata/ros/catkin_ws/build/libsiftfast/libsiftfast_svn/libsiftfast.cpp:356
[2] from 0x00007ffff01946b3 in imagesift::SiftNode::detect(posedetection_msgs::Feature0D_<std::allocator<void> >&, sensor_msgs::Image_<std::allocator<void> > const&, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)+1873 at /home/obinata/ros/catkin_ws/src/jsk-ros-pkg/jsk_recognition/imagesift/src/imagesift.cpp:177
[3] from 0x00007ffff019512c in imagesift::SiftNode::imageCb(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)+448 at /home/obinata/ros/catkin_ws/src/jsk-ros-pkg/jsk_recognition/imagesift/src/imagesift.cpp:231
[4] from 0x00007ffff01953c9 in imagesift::SiftNode::imageCb(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)+71 at /home/obinata/ros/catkin_ws/src/jsk-ros-pkg/jsk_recognition/imagesift/src/imagesift.cpp:247
[5] from 0x00007ffff01bd26d in boost::_mfi::mf1<void, imagesift::SiftNode, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&>::operator()(imagesift::SiftNode*, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&) const+117 at /usr/include/boost/bind/mem_fn_template.hpp:165
[6] from 0x00007ffff01ba43f in boost::_bi::list2<boost::_bi::value<imagesift::SiftNode*>, boost::arg<1> >::operator()<boost::_mfi::mf1<void, imagesift::SiftNode, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&>, boost::_bi::rrlist1<boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&> >(boost::_bi::type<void>, boost::_mfi::mf1<void, imagesift::SiftNode, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&>&, boost::_bi::rrlist1<boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&>&, int)+111 at /usr/include/boost/bind/bind.hpp:319
[7] from 0x00007ffff01b7513 in boost::_bi::bind_t<void, boost::_mfi::mf1<void, imagesift::SiftNode, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&>, boost::_bi::list2<boost::_bi::value<imagesift::SiftNode*>, boost::arg<1> > >::operator()<boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&>(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)+83 at /usr/include/boost/bind/bind.hpp:1306
[8] from 0x00007ffff01b3da8 in boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, imagesift::SiftNode, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&>, boost::_bi::list2<boost::_bi::value<imagesift::SiftNode*>, boost::arg<1> > >, void, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&>::invoke(boost::detail::function::function_buffer&, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)+47 at /usr/include/boost/function/function_template.hpp:158
[9] from 0x00007fffda78524f in image_transport::RawSubscriber::internalCallback(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&, boost::function<void (boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)> const&)
[+]
─── Threads ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[54] id 259558 name nodelet from 0x00007ffff7996345 in clone at ../sysdeps/unix/sysv/linux/x86_64/clone.S:78
[53] id 259557 name nodelet from 0x00007fffd813823e
[52] id 259556 name nodelet from 0x00007fffd813823e
[51] id 259555 name nodelet from 0x00007fffd813823e
[50] id 259554 name nodelet from 0x00007fffd813823e
[49] id 259553 name nodelet from 0x00007fffd813823e
[48] id 259552 name nodelet from 0x00007fffd813823e
[47] id 259551 name nodelet from 0x00007fffd813823e
[46] id 259550 name nodelet from 0x00007fffd813823e
[45] id 259549 name nodelet from 0x00007fffd813823e
[44] id 259548 name nodelet from 0x00007fffd813823e
[43] id 259547 name nodelet from 0x00007fffd813823e
[42] id 259546 name nodelet from 0x00007fffd813823e
[41] id 259545 name nodelet from 0x00007fffd813823e
[40] id 259544 name nodelet from 0x00007fffd813823e
[39] id 259543 name nodelet from 0x00007fffd813823e
[38] id 259542 name nodelet from 0x00007fffd813823e
[37] id 259541 name nodelet from 0x00007fffd813823e
[36] id 259540 name nodelet from 0x00007fffd813823e
[35] id 259539 name nodelet from 0x00007fffd813823e
[34] id 259538 name nodelet from 0x00007fffd813823e
[33] id 259537 name nodelet from 0x00007fffd813823e
[32] id 259536 name nodelet from 0x00007fffd813823e
[31] id 259535 name nodelet from 0x00007fffd813823e
[30] id 259524 name nodelet from 0x00007ffff78027d1 in futex_abstimed_wait_cancelable+415 at ../sysdeps/nptl/futex-internal.h:320
[29] id 259523 name nodelet from 0x00007ffff78027d1 in futex_abstimed_wait_cancelable+415 at ../sysdeps/nptl/futex-internal.h:320
[28] id 259522 name nodelet from 0x00007ffff78027d1 in futex_abstimed_wait_cancelable+415 at ../sysdeps/nptl/futex-internal.h:320
[27] id 259459 name nodelet from 0x00007ffff78027d1 in futex_abstimed_wait_cancelable+415 at ../sysdeps/nptl/futex-internal.h:320
[26] id 259458 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[25] id 259457 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[24] id 259456 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[23] id 259455 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[22] id 259454 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[21] id 259453 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[20] id 259452 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[19] id 259451 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[18] id 259450 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[17] id 259449 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[16] id 259448 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[15] id 259447 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[14] id 259446 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[13] id 259445 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[12] id 259444 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[11] id 259443 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[10] id 259442 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[9] id 259441 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[8] id 259440 name nodelet from 0x00007ffff7996345 in clone at ../sysdeps/unix/sysv/linux/x86_64/clone.S:78
[7] id 259439 name nodelet from 0x00007ffff7f1bc0d in OctaveKeypoints(Image, Image*, float, Keypoint)+269 at /home/obinata/ros/catkin_ws/build/libsiftfast/libsiftfast_svn/libsiftfast.cpp:513
[6] id 259438 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[5] id 259437 name nodelet from 0x00007ffff78027d1 in futex_abstimed_wait_cancelable+415 at ../sysdeps/nptl/futex-internal.h:320
[4] id 259435 name nodelet from 0x00007ffff7802376 in futex_wait_cancelable+29 at ../sysdeps/nptl/futex-internal.h:183
[3] id 259434 name nodelet from 0x00007ffff7989bbf in __GI___poll+79 at ../sysdeps/unix/sysv/linux/poll.c:29
[2] id 259432 name nodelet from 0x00007ffff799668e in epoll_wait+94 at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
[1] id 259421 name nodelet from 0x00007ffff78027d1 in futex_abstimed_wait_cancelable+415 at ../sysdeps/nptl/futex-internal.h:320
─── Variables ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
arg pimage = 0x7fffec0028a0, phalfimage = 0x7ffff1a0e3e0: 0x0, fscale = 0.5, prevkeypts = 0x0
loc i = 2, fwidth = 1.25992107, fincsigma = 0.76642102, rows = 958, cols = 1278, stride = 1278, sigma = 2.01587367
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
>>> where
#0 0x00007ffff7f1bc0d in OctaveKeypoints (pimage=pimage@entry=0x7fffec0028a0, phalfimage=phalfimage@entry=0x7ffff1a0e3e0, fscale=fscale@entry=0.5, prevkeypts=prevkeypts@entry=0x0) at /home/obinata/ros/catkin_ws/build/libsiftfast/libsiftfast_svn/libsiftfast.cpp:513
#1 0x00007ffff7f1be94 in GetKeypointsInternal (porgimage=<optimized out>) at /home/obinata/ros/catkin_ws/build/libsiftfast/libsiftfast_svn/libsiftfast.cpp:356
#2 0x00007ffff01946b3 in imagesift::SiftNode::detect (this=0x555556669ab0, features=..., imagemsg=..., mask_ptr=...) at /home/obinata/ros/catkin_ws/src/jsk-ros-pkg/jsk_recognition/imagesift/src/imagesift.cpp:177
#3 0x00007ffff019512c in imagesift::SiftNode::imageCb (this=0x555556669ab0, msg_ptr=..., mask_ptr=...) at /home/obinata/ros/catkin_ws/src/jsk-ros-pkg/jsk_recognition/imagesift/src/imagesift.cpp:231
#4 0x00007ffff01953c9 in imagesift::SiftNode::imageCb (this=0x555556669ab0, msg_ptr=...) at /home/obinata/ros/catkin_ws/src/jsk-ros-pkg/jsk_recognition/imagesift/src/imagesift.cpp:247
#5 0x00007ffff01bd26d in boost::_mfi::mf1<void, imagesift::SiftNode, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&>::operator() (this=0x7fffb4006600, p=0x555556669ab0, a1=...) at /usr/include/boost/bind/mem_fn_template.hpp:165
#6 0x00007ffff01ba43f in boost::_bi::list2<boost::_bi::value<imagesift::SiftNode*>, boost::arg<1> >::operator()<boost::_mfi::mf1<void, imagesift::SiftNode, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&>, boost::_bi::rrlist1<boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&> > (this=0x7fffb4006610, f=..., a=...) at /usr/include/boost/bind/bind.hpp:319
#7 0x00007ffff01b7513 in boost::_bi::bind_t<void, boost::_mfi::mf1<void, imagesift::SiftNode, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&>, boost::_bi::list2<boost::_bi::value<imagesift::SiftNode*>, boost::arg<1> > >::operator()<boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&> (this=0x7fffb4006600, a1=...) at /usr/include/boost/bind/bind.hpp:1306
#8 0x00007ffff01b3da8 in boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, imagesift::SiftNode, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&>, boost::_bi::list2<boost::_bi::value<imagesift::SiftNode*>, boost::arg<1> > >, void, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&>::invoke (function_obj_ptr=..., a0=...) at /usr/include/boost/function/function_template.hpp:158
#9 0x00007fffda78524f in image_transport::RawSubscriber::internalCallback(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&, boost::function<void (boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)> const&) () from /opt/ros/noetic/lib//libimage_transport_plugins.so
#10 0x00007ffff007c162 in boost::detail::function::void_function_obj_invoker1<boost::function<void (boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)>, void, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> >::invoke(boost::detail::function::function_buffer&, boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const>) () from /opt/ros/noetic/lib/libimage_transport.so
#11 0x00007fffda78951d in ros::SubscriptionCallbackHelperT<boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&, void>::call(ros::SubscriptionCallbackHelperCallParams&) () from /opt/ros/noetic/lib//libimage_transport_plugins.so
#12 0x00007ffff7e79139 in ros::SubscriptionQueue::call() () from /opt/ros/noetic/lib/libroscpp.so
#13 0x00007ffff7e27172 in ros::CallbackQueue::callOneCB(ros::CallbackQueue::TLS*) () from /opt/ros/noetic/lib/libroscpp.so
#14 0x00007ffff7e27f15 in ros::CallbackQueue::callOne(ros::WallDuration) () from /opt/ros/noetic/lib/libroscpp.so
#15 0x00007ffff7fa9279 in nodelet::detail::CallbackQueue::callOne() () from /opt/ros/noetic/lib/libnodeletlib.so
#16 0x00007ffff7fabd17 in nodelet::detail::CallbackQueueManager::workerThread(nodelet::detail::CallbackQueueManager::ThreadInfo*) () from /opt/ros/noetic/lib/libnodeletlib.so
#17 0x00007ffff77ba43b in ?? () from /lib/x86_64-linux-gnu/libboost_thread.so.1.71.0
#18 0x00007ffff77fb609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#19 0x00007ffff7996353 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95