Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roslaunch exit code 0 even if requried node died with non-zero exit code #919

Open
sd1074 opened this issue Oct 28, 2016 · 9 comments
Open

Comments

@sd1074
Copy link

sd1074 commented Oct 28, 2016

Currently (at least in my indigo installation), if one of the nodes launched by roslaunch dies due to an error or from a signal, roslaunch is able to catch that and report, but its exit code is still 0.
This makes if hard to verify whether roslaunch was successful or not.
I am not sure if it's a bug report or a feature request, but I think propagating required node's exit code to ros roslaunch exit code would be a useful imp.

The described behavior was confirmed here:
http://answers.ros.org/question/219115/exit-code-of-roslaunch-shutdown-on-node-death/

It can also be easily verified with a simple launch file:

<?xml version="1.0"?>
<launch>
    <node pkg="turtlesim" type="turtlesim_node" name="turtlesim_node" output="screen" required="true" />
</launch>

run it, then kill the node:
$ kill -9 <TURTLESIM_NODE_PID>

roslaunch then shuts down with:

================================================================================REQUIRED process [turtlesim_node-1] has died!
process has died [pid 4832, exit code -9, cmd /opt/ros/indigo/lib/turtlesim/turtlesim_node __name:=turtlesim_node __log:=/home/USER/.ros/log/a1339242-9d30-11e6-b60e-9c4e36311474/turtlesim_node-1.log].
log file: /home/sd/.ros/log/a1339242-9d30-11e6-b60e-9c4e36311474/turtlesim_node-1*.log
Initiating shutdown!
================================================================================
[turtlesim_node-1] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done

The reported error code is:

$ echo $?
0

I believe that even if not via exit code, there should be some easy mechanism to check whether roslaunch succeeded or failed (based on the required node exit code).

@TeeJayR
Copy link

TeeJayR commented Jan 3, 2017

One could directly check the exit code of the started nodes as roslaunch prints the node's pid, but I don`t see a way to do this programmatically and agree that roslaunch should forward the exit code of the node. But what if multiple nodes have been started by roslaunch?

@alspitz
Copy link
Contributor

alspitz commented Jul 19, 2018

At least if a required node dies, I think it would be better if roslaunch returned any non-zero exit code instead of 0.

@xkortex
Copy link

xkortex commented Nov 22, 2019

This makes it challenging to containerize ROS nodes or stacks.

 [nodename] process has died [pid 136, exit code -6 ...

is what I see when a node has an unhandled exception, then the container goes down,

containername- exited with code 0

No obvious way to intercept this, either. Can't trust presence of stderr, as some applications will roslog error but then recover.

@LukeAI
Copy link

LukeAI commented May 11, 2020

Was there a conclusion to this? I also want to be able to programmatically check whether or not a roslaunch failed. @dirk-thomas I see you added the enhancement tag - do you know if there is some way of getting the exit code of the child node?

@dirk-thomas
Copy link
Member

dirk-thomas commented May 13, 2020

I assume not at the moment. Please consider to contribute a pull request to enable this.

@xkortex
Copy link

xkortex commented May 17, 2020

I might be able to do it if someone could point roughly in the stack where to look or what keywords to grep for.

lucasw added a commit to lucasw/ros_comm that referenced this issue Jul 28, 2020
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Jul 28, 2020
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
@lucasw
Copy link
Contributor

lucasw commented Jul 28, 2020

@xkortex I'm also trying to get failed required nodes to make ci jobs fail, and started experimenting with this in lucasw@0eb9ba4 . Use with caution- there were some odd cases where roslaunch lost track of child processes but I think I'm avoiding that now.

lucasw added a commit to lucasw/ros_comm that referenced this issue Jul 28, 2020
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
@betaboon
Copy link

@lucasw any update on your branch? is there anything we can do to assist you in getting this finalized/tested? i got here due to the same reason: a simple smoketest in ci :)

lucasw added a commit to lucasw/ros_comm that referenced this issue Oct 19, 2020
… a regular parent launch process, child and remote processes need looking at.

May solve ros#919
lucasw added a commit to lucasw/ros_comm that referenced this issue Oct 19, 2020
… a regular parent launch process, child and remote processes need looking at.

May solve ros#919
@lucasw
Copy link
Contributor

lucasw commented Oct 19, 2020

@betaboon I put it into a PR #2082

lucasw added a commit to lucasw/ros_comm that referenced this issue Nov 6, 2020
… a regular parent launch process, child and remote processes need looking at.

May solve ros#919
lucasw added a commit to lucasw/ros_comm that referenced this issue Nov 21, 2020
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Mar 21, 2021
… a regular parent launch process, child and remote processes need looking at.

May solve ros#919
lucasw added a commit to lucasw/ros_comm that referenced this issue Oct 11, 2021
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Oct 21, 2021
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Dec 3, 2021
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue May 8, 2022
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Jun 11, 2022
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Jun 11, 2022
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Apr 9, 2023
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Apr 9, 2023
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue May 1, 2023
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue May 1, 2023
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue May 1, 2023
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Jun 2, 2023
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Nov 25, 2023
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Nov 25, 2023
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Dec 6, 2023
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Jan 1, 2024
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Jan 1, 2024
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Jan 1, 2024
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Jun 8, 2024
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
lucasw added a commit to lucasw/ros_comm that referenced this issue Jul 17, 2024
…process at least for a regular parent launch process, child and remote processes need looking at.

May solve ros#919 but needs to be cleaned up and put into standalone branch.
rhaschke pushed a commit to ubi-agni/ros_comm that referenced this issue Aug 20, 2024
rhaschke pushed a commit to ubi-agni/ros_comm that referenced this issue Aug 20, 2024
rhaschke pushed a commit to ros-o/ros_comm that referenced this issue Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants