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

KeyboardInterrupt exception on shutdown #104

Open
Timple opened this issue Apr 16, 2024 · 1 comment
Open

KeyboardInterrupt exception on shutdown #104

Timple opened this issue Apr 16, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Timple
Copy link

Timple commented Apr 16, 2024

Description

KeyboardInterrupt exception on shutdown

Expected Behavior

Clean shutdown

Actual Behavior

[relay_field-69] Traceback (most recent call last):
[relay_field-69]   File "/opt/ros/iron/lib/topic_tools/relay_field", line 33, in <module>
[relay_field-69]     sys.exit(load_entry_point('topic-tools==1.2.0', 'console_scripts', 'relay_field')())
[relay_field-69]   File "/opt/ros/iron/lib/python3.10/site-packages/topic_tools/relay_field.py", line 226, in main
[relay_field-69]     node.destroy_node()
[relay_field-69]   File "/opt/ros/iron/lib/python3.10/site-packages/rclpy/node.py", line 1887, in destroy_node
[relay_field-69]     self.__node.destroy_when_not_in_use()
[relay_field-69] KeyboardInterrupt

To Reproduce

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

  1. ros2 topic pub /chatter std_msgs/String "{}"
  2. ros2 run topic_tools relay_field /chatter /chatter2 std_msgs/String "{data: m.data}"
  3. Press ctrl+C
  4. Watch error

System (please complete the following information)

  • OS: Ubuntu
  • ROS 2 Distro: Iron
@Timple Timple added the bug Something isn't working label Apr 16, 2024
@MichaelOrlov MichaelOrlov self-assigned this Apr 16, 2024
@MichaelOrlov
Copy link
Member

Preliminary analysis

The failure is very strange.
It turns out that we already have KeyboardInterrupt handler in the relevant relay_field.py

node = RelayField(args)
try:
rclpy.spin(node)
except KeyboardInterrupt:
print('relay_field stopped cleanly')
except BaseException:
print('exception in relay_field:', file=sys.stderr)
raise
finally:
node.destroy_node()
rclpy.shutdown()

Also according to the call stack, the failure happened inside node.destroy_node() call on the self.__node.destroy_when_not_in_use().

It might be that SIGINT arrived twice. i.e., the second time when we were already in the final stage in the self.__node.destroy_when_not_in_use(). Need to reproduce and debug this issue.

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

No branches or pull requests

2 participants