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

ros2 bag play exiting with code 2 by SIGINT or CTRL+C #1123

Closed
MichaelOrlov opened this issue Oct 13, 2022 · 0 comments · Fixed by #1126
Closed

ros2 bag play exiting with code 2 by SIGINT or CTRL+C #1123

MichaelOrlov opened this issue Oct 13, 2022 · 0 comments · Fixed by #1126
Assignees
Labels
bug Something isn't working

Comments

@MichaelOrlov
Copy link
Contributor

Description

ros2 bag play exiting with code 2 by SIGINT or CTRL+C

Expected Behavior

ros2 bag play shall exiting with code 0 by SIGINT or CTRL+C

Actual Behavior

ros2 bag play exiting with code 2 by SIGINT or CTRL+C

To Reproduce

** Steps to reproduce the behavior, e.g.

  1. Go to 'ros2_rolling' cloned folder
  2. source ./install/setup.bash
  3. Run tmux
  4. In tmux panel 1 run commands:
ros2 bag play --loop src/ros2/rosbag2/rosbag2_tests/resources/cdr_test
  1. In tmux panel 2 run command
ps -aux | grep "ros2 bag play"
  1. Find PID for ros2 bag play. For instance 195930
  2. In tmux panel 2 run command
kill -s 2 195930

or alternatively switch to the tmux panel 1 and pres CTRL+C
8. In tmux panel 1 run command

echo $?

echo $? will output exit code from last finished process.

System (please complete the following information)

  • OS: Ubuntu 22.04 LTS
  • ROS 2 Distro: Rolling
  • Version: rolling branch

RCA

  1. rosbag2 player successfully and correctly finishing after processing SIGINT signal.
  2. The problem in python part of the ros2 bag play verb.

Proposed solution

Don't propagate KeyboardInterrupt exception from python code in

player.play(storage_options, play_options)

use instead following try catch block.

 try:
     player.play(storage_options, play_options)
        except KeyboardInterrupt:
     pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant