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

What happens to message on failure/exception/error in subscribing node

asked 2019-11-12 07:13:12 -0500

PhilippJust gravatar image


I am using ROS melodic with rospy. If I am creating a subscription like

    subscription = rospy.Subscriber(name="topic_name", data_class=std_msgs.msg.String, callback=handle_message, queue_size = 1000)
   def handle_message(message):
            #some code that may fail and raise and exception

What will happen if there is an exception within handle_message? Will the message be lost or will be put back to the queue?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-11-13 05:57:07 -0500

PhilippJust gravatar image

I made a simple unittest with rostest. It turns out that the messages will be lost if the callback function throws an exception.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-11-12 07:13:12 -0500

Seen: 210 times

Last updated: Nov 13 '19