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

Prevent roslaunch from SIGKILLing rosbag on completion

asked 2022-04-06 14:53:39 -0600

billtheplatypus gravatar image

I am running a simulation from a roslaunch file. Once the relevant part of the simulation finishes, a required node exits, which prompts roslaunch to terminate all nodes. The simulation is relatively short, but generates a lot of high-resolution images, and so the rosbag record node often can't write to disk in real time, and messages are still in the buffer when the simulation finishes. When roslaunch terminates all nodes, it first sends SIGTERM, which stops rosbag from recording any new messages while it writes the buffer to disk.

All of the above is exactly how I would like it to work. However, after a few seconds, if rosbag has not finished writing to disk, roslaunch escalates to SIGKILL, which immediately kills rosbag, preventing buffered messages from being written and leaving a .bag.active file. I understand that this is intended and generally useful behavior, but in this case I would prefer to not escalate to SIGKILL, so that rosbag can finish writing to disk.

Is there anyway to prevent roslaunch from sending SIGKILL, either to a specific node or to any node? Alternatively, can I set the timeout before SIGKILL to a large value?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-04-07 00:49:38 -0600

gvdhoorn gravatar image

updated 2022-04-07 00:55:22 -0600

You labelled this noetic, which gives you access to these two arguments for roslaunch (from roslaunch --help):

  --sigint-timeout=SIGINT_TIMEOUT
                        the SIGINT timeout used when killing nodes (in
                        seconds).
  --sigterm-timeout=SIGTERM_TIMEOUT
                        the SIGTERM timeout used when killing nodes if SIGINT
                        does not stop the node (in seconds).

I believe --sigterm-timeout=<some_value> would let you do what you describe.


Edit: I just noticed you mention SIGKILL. Looking at the sources (here), there doesn't appear to be any way to influence that part of the shutdown behaviour directly (other than editing nodeprocess.py).

Configuring a larger SIGTERM timeout will cause roslaunch to escalate to SIGKILL later, but that's only a side-effect.

A work-around could be to start rosbag manually, or use a separate roslaunch instance (ie: one which doesn't monitor the required="true" node.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-04-06 14:53:39 -0600

Seen: 424 times

Last updated: Apr 07 '22