Skip to content

tf2_ros_py: Ignore ExternalShutdownException in background thread#930

Merged
ahcorde merged 1 commit intoros2:rollingfrom
peci1:patch-1
May 6, 2026
Merged

tf2_ros_py: Ignore ExternalShutdownException in background thread#930
ahcorde merged 1 commit intoros2:rollingfrom
peci1:patch-1

Conversation

@peci1
Copy link
Copy Markdown
Contributor

@peci1 peci1 commented May 5, 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

Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz>
@ahcorde
Copy link
Copy Markdown
Contributor

ahcorde commented May 5, 2026

Pulls: #930
Gist: https://gist.githubusercontent.com/ahcorde/f6e705b0c8c0ee3ae81a4195a84bb449/raw/740438f17162012b56511562da8fe6ebdd9011ea/ros2.repos
BUILD args: --packages-above-and-dependencies tf2_ros_py
TEST args: --packages-above tf2_ros_py
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/19140

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

@ahcorde ahcorde merged commit a7a5bcf into ros2:rolling May 6, 2026
2 checks passed
@ahcorde
Copy link
Copy Markdown
Contributor

ahcorde commented May 6, 2026

https://github.com/Mergifyio backport lyrical kilted jazzy humble

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 6, 2026

backport lyrical kilted jazzy humble

✅ Backports have been created

Details

Cherry-pick of a7a5bcf has failed:

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

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

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

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.

2 participants