topic_tools
topic_tools copied to clipboard
`KeyboardInterrupt` exception on shutdown
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.
-
ros2 topic pub /chatter std_msgs/String "{}"
-
ros2 run topic_tools relay_field /chatter /chatter2 std_msgs/String "{data: m.data}"
- Press ctrl+C
- Watch error
System (please complete the following information)
- OS: Ubuntu
- ROS 2 Distro: Iron
Preliminary analysis
The failure is very strange.
It turns out that we already have KeyboardInterrupt
handler in the relevant relay_field.py
https://github.com/ros-tooling/topic_tools/blob/cefac4787f10a706d4bacf115c628b95f5033461/topic_tools/topic_tools/relay_field.py#L217-L227
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.