Skip to content

Bugfix: executor doesn't propagate exception from task that awaited a future (backport #1643)#1651

Open
mergify[bot] wants to merge 1 commit into
kiltedfrom
mergify/bp/kilted/pr-1643
Open

Bugfix: executor doesn't propagate exception from task that awaited a future (backport #1643)#1651
mergify[bot] wants to merge 1 commit into
kiltedfrom
mergify/bp/kilted/pr-1643

Conversation

@mergify

@mergify mergify Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #1642

Changes

A task now registers itself on the awaited future via new Future._add_waiting_task.
The executor then dispatches the same Task object and sees its exception through handler.exception() as intended.

  • Future._callbacks now holds Union[Callable, Task]
  • _schedule_or_invoke_done_callbacks handles Task entries through executor._call_task_in_next_spin.
  • _wait_for_ready_callbacks skips tasks that were cancelled or completed between being queued and being popped.
  • A warnings.warn fires if a waiting Task is dropped because the executor weakref could not be resolved.
    This is an automatic backport of pull request Bugfix: executor doesn't propagate exception from task that awaited a future #1643 done by Mergify.

… future (#1643)

* Schedule the original task when task awaits a future

Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>

* Add MultiThreadedExecutor to test

Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>

* Add tests for awaiting a done future and task cancellation during await

Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>

* Removed unused variable

Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>

---------

Signed-off-by: Nadav Elkabets <elnadav12@gmail.com>
(cherry picked from commit aac0ebb)
@mergify

mergify Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@ahcorde

ahcorde commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Pulls: #1651
Gist: https://gist.githubusercontent.com/ahcorde/ff5816bf4d6c64bd2d750da06ac903d0/raw/a475e38433b2be634f5d725d53e267fa6fb78156/ros2.repos
BUILD args: --packages-above-and-dependencies rclpy
TEST args: --packages-above rclpy
ROS Distro: kilted
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/19624

  • 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants