ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Using respawn= "true" , ensure a clean restart ? [closed]

asked 2016-02-17 12:46:22 -0500

cnanda84 gravatar image

When using a respawn ="true" in the launch file, does ros automatically terminate the associated process or does that have to be handled by the user somehow. We are using kinect2_bridge nodelet and see that under some circumstances, when it crashes, fails to recover as the associated process is still hanging around or complains that a old node with the same name already exists. Manually looking for a process with ps -lae | grep nodelet and then killing it solves the problem.
Will increasing the delay help ? -cn

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Procópio
close date 2018-02-07 06:40:16.505033

1 Answer

Sort by » oldest newest most voted

answered 2016-02-17 13:20:43 -0500

ahendrix gravatar image

The respawn="true" functionality detects when the node crashes by detecting when the process terminates.

If the process for the node doesn't terminate, it doesn't detect that it has crashed, and therefore it isn't restarted.

edit flag offensive delete link more


A simple related question, can this feature be used for a nodelet as well ? Or is it only meant for a node ? I didn't explicitly mention it but we are using a nodelet when observing this problem.

cnanda84 gravatar image cnanda84  ( 2016-02-25 13:09:13 -0500 )edit

respwan was designed to work with nodes; you may see different behavior with nodelets, The nodelet runs in the manager's process space; not in the loader, but roslaunch will be trying to restart the loader.

ahendrix gravatar image ahendrix  ( 2016-02-25 13:21:33 -0500 )edit

Another unrelated question, so if my code hangs in between( some software bug ). Will the re-spawn feature help me restart the node ? Also, can I expect it to restart the node in case of a segmentation fault ?

cnanda84 gravatar image cnanda84  ( 2016-02-25 14:17:12 -0500 )edit

As I already explained, roslaunch only restarts your node when the process terminates (this includes segfaults). If your process is still running and is hung somewhere, roslaunch will not restart.

ahendrix gravatar image ahendrix  ( 2016-02-25 15:45:54 -0500 )edit

In general, roslaunch will never stop your process; it only restarts it if it has already stopped for some other reason.

ahendrix gravatar image ahendrix  ( 2016-02-25 15:47:54 -0500 )edit

Question Tools


Asked: 2016-02-17 12:46:22 -0500

Seen: 1,783 times

Last updated: Feb 17 '16