ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

compressed_image_transport segmentation fault

asked 2016-03-06 22:00:44 -0500

meeple gravatar image

updated 2016-03-07 20:38:46 -0500

On Ubuntu, I wrote a simple subscriber and display with cv::imshow. It works with raw image, but if I set the image_transport param to "compressed" it immediately gives segmentation fault. I am guessing that it has something to do with cvbridge::toCvShare not decoding the compressed image correctly or somehow not compatible with opencv. Is there a fix? Thank you.

gbd response: Program received signal SIGSEGV, Segmentation fault. 0x00007ffff79a036c in cv::imdecode(cv::_InputArray const&, int) () from /usr/lib/x86_64-linux-gnu/ (gdb)

#0  0x00007ffff79a036c in cv::imdecode(cv::_InputArray const&, int) ()
   from /usr/lib/x86_64-linux-gnu/
#1  0x00007fffd15174d7 in ?? ()
   from /opt/ros/indigo/lib//
#2  0x00007fffd151914c in ?? ()
   from /opt/ros/indigo/lib//
#3  0x00007fffd151c1d0 in ?? ()
   from /opt/ros/indigo/lib//
#4  0x00007ffff74bf9c5 in ros::SubscriptionQueue::call() ()
   from /opt/ros/indigo/lib/
#5  0x00007ffff747d777 in ros::CallbackQueue::callOneCB(ros::CallbackQueue::TLS) () from /opt/ros/indigo/lib/
#6  0x00007ffff747e583 in ros::CallbackQueue::callAvailable(ros::WallDuration)
    () from /opt/ros/indigo/lib/
#7  0x00007ffff74c24e5 in ros::SingleThreadedSpinner::spin(ros::CallbackQueue)
    () from /opt/ros/indigo/lib/
#8  0x00007ffff74aaaeb in ros::spin() () from /opt/ros/indigo/lib/
#9  0x0000000000407369 in main (argc=1, argv=0x7fffffffd9d8)
    at /home/ethan/camera/src/camera_reader/src/reader.cpp:27

source code is unmodified.

edit retag flag offensive close merge delete


image_transport should have already decompressed the image before it's ever passed into your callback. Have you tried running your node in a debugger to figure out where the segfault is occurring?

ahendrix gravatar image ahendrix  ( 2016-03-07 01:10:56 -0500 )edit

gdb says it comes from opencv "cv::imdecode(....) " Is it somehow not recognizing the decompressed image?

meeple gravatar image meeple  ( 2016-03-07 13:18:59 -0500 )edit

That's strange. Can you edit your question to include your subscriber code (or a simplified version that still exhibits this issue), and the gdb backtrace that you get? Please use the "Preformatted Text (101010)" button when formatting source code, so that it's easily readable.

ahendrix gravatar image ahendrix  ( 2016-03-07 13:37:14 -0500 )edit

This looks like a bug. When the program finishes in gdb, please run the backtrace command to get a full stack trace of the crash location.

ahendrix gravatar image ahendrix  ( 2016-03-07 19:20:58 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-07 21:19:18 -0500

ahendrix gravatar image

The stacktrace that you've posted is clearly not in your code. Therefore, this looks like a bug in the image transport library.

You should record a short bag file with the image topics in question, and verify that you can reproduce this issue by playing back the bag file with the example code running.

Once you're able to reproduce the issue with a small bag file and the sample program, you should open a ticket against the image_transport bug tracker. Be sure to include the versions of image_transport, ROS, OpenCV and Ubuntu that you're using.

Keeping the bag file small will make it quicker and easier for the package maintainer to download it and reproduce your issue.

edit flag offensive delete link more

Question Tools


Asked: 2016-03-06 22:00:44 -0500

Seen: 1,120 times

Last updated: Mar 07 '16