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

Canceling an action goal returns "Exception while canceling goal: None" #1390

Open
sea-bass opened this issue Dec 19, 2024 · 5 comments · May be fixed by ros2/ros2cli#956
Open

Canceling an action goal returns "Exception while canceling goal: None" #1390

sea-bass opened this issue Dec 19, 2024 · 5 comments · May be fixed by ros2/ros2cli#956
Assignees
Labels
bug Something isn't working

Comments

@sea-bass
Copy link

sea-bass commented Dec 19, 2024

Bug report

Required Info:

  • Operating System:
    • Ubuntu 24.04
  • Installation type:
    • Binaries
  • Version or commit hash:
    • 7.7.0
  • DDS implementation:
    • FastDDS or CycloneDDS
  • Client library (if applicable):
    • rclpy

Steps to reproduce issue

I'm not entirely sure this is a bug, but it was pointed out to me in an issue on one of my own repos (sea-bass/pyrobosim#310). I could then reproduce it with the simple rclpy examples:

If I start an example action server and then cancel it:

ros2 run examples_rclpy_minimal_action_server server_single_goal 

ros2 action send_goal /fibonacci example_interfaces/action/Fibonacci "{order: 100}"

Ctrl + C

The output is the following

Waiting for an action server to become available...
Sending goal:
     order: 100

Goal accepted with ID: 8deec6ba2ecb430e81c476963f65b6dc

Canceling goal...
Exception while canceling goal: None

Expected behavior

It should say something like

Canceling goal...
Goal canceled

Actual behavior

Canceling goal...
Exception while canceling goal: None
@fujitatomoya
Copy link
Collaborator

This can be reproduced with rolling source code build.

@fujitatomoya fujitatomoya added the bug Something isn't working label Dec 20, 2024
@fujitatomoya
Copy link
Collaborator

I thin the root cause of this is SIGINT handler in rclpy,

rclpy::shutdown_contexts();

rclpy::shutdown_context will be called in another deferred thread once the signal comes in. precisely this thread is waiting on the semaphore from the signal handler.

and in the final statement, it tries to send the cancel request. i confirmed that this request is delivered to the action server and action server sends the response to the client. but client never gets this response message, because at this time context is already shut down by deferred thread. that makes cancel result is None, and generate the RuntimeError exception by ros2action.

i think we need to have the signal handler, and expects that is the cancel request from the terminal.

@fujitatomoya
Copy link
Collaborator

@sea-bass thanks for posting issue.

can you try ros2/ros2cli#956 see if that fixes your problem too? that would be really appreciated.

@sea-bass
Copy link
Author

ros2 action send_goal /fibonacci example_interfaces/action/Fibonacci "{order: 100}"

Just tested and can confirm this fixes the issue -- thanks @fujitatomoya!

@fujitatomoya
Copy link
Collaborator

@sea-bass thanks for testing.

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.

2 participants