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

Shutdown ros2doctor hello when ctrl-c is received #826

Merged
merged 1 commit into from
May 8, 2023

Conversation

mjcarroll
Copy link
Member

Uncovered in tutorial party: osrf/ros2_test_cases#548

There was an issue where ros2 doctor hello would not shutdown on Windows, instead hanging with the trace:

Traceback (most recent call last):
  File "C:\Python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Python38\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\ros2_iron\Lib\site-packages\rclpy\executors.py", line 280, in spin
    self.spin_once()
  File "C:\ros2_iron\Lib\site-packages\rclpy\executors.py", line 717, in spin_once
    handler, entity, node = self.wait_for_ready_callbacks(timeout_sec=timeout_sec)
  File "C:\ros2_iron\Lib\site-packages\rclpy\executors.py", line 703, in wait_for_ready_callbacks
    return next(self._cb_iter)
  File "C:\ros2_iron\Lib\site-packages\rclpy\executors.py", line 604, in _wait_for_ready_callbacks
    raise ExternalShutdownException()
rclpy.executors.ExternalShutdownException

I believe this is because once the rclpy signal handler is installed, the KeyboardInterrupt was not getting triggered in the main thread. This makes it so that the executor thread will additionally call shutdown in the case that the signal is handled there first.

Signed-off-by: Michael Carroll <mjcarroll@intrinsic.ai>
@mjcarroll
Copy link
Member Author

CC @Yadunund and @clalancette

Copy link
Member

@Yadunund Yadunund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gave this a spin.
image

Ctrl+C triggers the shutdown properly.

The rcl_shutdown exception which now gets thrown is a known issue with rclpy which we plan to address.

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not have windows platform, but fix looks good to me.

@clalancette
Copy link
Contributor

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@clalancette clalancette merged commit e875ed0 into rolling May 8, 2023
2 checks passed
@delete-merged-branch delete-merged-branch bot deleted the mjcarroll/doctor_ctrl_c branch May 8, 2023 14:38
@clalancette
Copy link
Contributor

@Mergifyio backport iron

@mergify
Copy link

mergify bot commented May 8, 2023

backport iron

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request May 8, 2023
Signed-off-by: Michael Carroll <mjcarroll@intrinsic.ai>
(cherry picked from commit e875ed0)
clalancette pushed a commit that referenced this pull request May 8, 2023
Signed-off-by: Michael Carroll <mjcarroll@intrinsic.ai>
(cherry picked from commit e875ed0)

Co-authored-by: Michael Carroll <mjcarroll@intrinsic.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants