Skip to content

tf2_ros_py: Ignore ExternalShutdownException in background thread (backport #930)#934

Open
mergify[bot] wants to merge 2 commits intohumblefrom
mergify/bp/humble/pr-930
Open

tf2_ros_py: Ignore ExternalShutdownException in background thread (backport #930)#934
mergify[bot] wants to merge 2 commits intohumblefrom
mergify/bp/humble/pr-930

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented May 6, 2026

Description

I've seen this exception when Ctrl-C-ing a program with TransformListener that uses background thread:

[exploration_evaluator-1] [occupancy_mapper-19] Exception in thread Thread-1 (run_func):
[exploration_evaluator-1] [occupancy_mapper-19] Traceback (most recent call last):
[exploration_evaluator-1] [occupancy_mapper-19]   File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
[exploration_evaluator-1] [occupancy_mapper-19]     self.run()
[exploration_evaluator-1] [occupancy_mapper-19]   File "/usr/lib/python3.12/threading.py", line 1010, in run
[exploration_evaluator-1] [occupancy_mapper-19]     self._target(*self._args, **self._kwargs)
[exploration_evaluator-1] [occupancy_mapper-19]   File "/opt/ros/kilted/lib/python3.12/site-packages/tf2_ros/transform_listener.py", line 115, in run_func
[exploration_evaluator-1] [occupancy_mapper-19]     self.executor.spin()
[exploration_evaluator-1] [occupancy_mapper-19]   File "/opt/ros/kilted/lib/python3.12/site-packages/rclpy/executors.py", line 374, in spin
[exploration_evaluator-1] [occupancy_mapper-19]     self.spin_once()
[exploration_evaluator-1] [occupancy_mapper-19]   File "/opt/ros/kilted/lib/python3.12/site-packages/rclpy/executors.py", line 968, in spin_once
[exploration_evaluator-1] [occupancy_mapper-19]     self._spin_once_impl(timeout_sec)
[exploration_evaluator-1] [occupancy_mapper-19]   File "/opt/ros/kilted/lib/python3.12/site-packages/rclpy/executors.py", line 951, in _spin_once_impl
[exploration_evaluator-1] [occupancy_mapper-19]     handler, entity, node = self.wait_for_ready_callbacks(
[exploration_evaluator-1] [occupancy_mapper-19]                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[exploration_evaluator-1] [occupancy_mapper-19]   File "/opt/ros/kilted/lib/python3.12/site-packages/rclpy/executors.py", line 921, in wait_for_ready_callbacks
[exploration_evaluator-1] [occupancy_mapper-19]     return next(self._cb_iter)
[exploration_evaluator-1] [occupancy_mapper-19]            ^^^^^^^^^^^^^^^^^^^
[exploration_evaluator-1] [occupancy_mapper-19]   File "/opt/ros/kilted/lib/python3.12/site-packages/rclpy/executors.py", line 827, in _wait_for_ready_callbacks
[exploration_evaluator-1] [occupancy_mapper-19]     raise ExternalShutdownException()
[exploration_evaluator-1] [occupancy_mapper-19] rclpy.executors.ExternalShutdownException

This PR silences this exception.

Is this user-facing behavior change?

No

Did you use Generative AI?

No


This is an automatic backport of pull request #930 done by Mergify.

Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz>
(cherry picked from commit a7a5bcf)

# Conflicts:
#	tf2_ros_py/tf2_ros/transform_listener.py
@mergify mergify Bot added the conflicts label May 6, 2026
@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented May 6, 2026

Cherry-pick of a7a5bcf has failed:

On branch mergify/bp/humble/pr-930
Your branch is up to date with 'origin/humble'.

You are currently cherry-picking commit a7a5bcf.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   tf2_ros_py/tf2_ros/transform_listener.py

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
@ahcorde
Copy link
Copy Markdown
Contributor

ahcorde commented May 6, 2026

Pulls: #934
Gist: https://gist.githubusercontent.com/ahcorde/6bae607d489d8c115c3be4d001e71873/raw/8fd6138df46d954e42e033ba49d5345486787b82/ros2.repos
BUILD args: --packages-above-and-dependencies tf2_ros_py
TEST args: --packages-above tf2_ros_py
ROS Distro: humble
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/19159

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants