boost::thread_resource_error Upon ROS Topic Disconnection

asked 2014-12-29 15:04:54 -0600

liangfok gravatar image

I'm running Ubuntu 12.04, ROS Hydro, and RTAI 3.9. I have a ROS node that instantiates an RTAI real-time thread and subscribes to various ROS topics. When another node publishes to one of these ROS topics and then disconnects, the ROS node containing the real-time thread crashes with a "boost::thread_resource_error".

Using gdb, I see that the cause is due to roscpp starting a thread upon disconnection of the remote node:

#7  0xb7c6c84c in void boost::throw_exception<boost::thread_resource_error>(boost::thread_resource_error const&) () from /opt/ros/hydro/lib/libroscpp.so
#8  0xb76853eb in boost::thread::start_thread() () from /usr/lib/libboost_thread.so.1.46.1
#9  0xb7c88c59 in ros::TimerManager<ros::WallTime, ros::WallDuration, ros::WallTimerEvent>::add(ros::WallDuration const&, boost::function<void (ros::WallTimerEvent const&)> const&, ros::CallbackQueueInterface*, boost::shared_ptr<void const> const&, bool) () from /opt/ros/hydro/lib/libroscpp.so
#10 0xb7cded9c in ros::TransportPublisherLink::onConnectionDropped(boost::shared_ptr<ros::Connection> const&, ros::Connection::DropReason) () from /opt/ros/hydro/lib/libroscpp.so

I'm fairly sure the problem is related to the use of RTAI because it does not occur when I disable the creation of an RTAI real-time thread.

The creation of the ROS topic subscribers is done by a non-real-time thread prior to creation of the RTAI real-time thread.

Does anybody know how to fix this problem?

edit retag flag offensive close merge delete