Skip to content

Conversation

@nwn
Copy link
Contributor

@nwn nwn commented Oct 24, 2025

Description

A recent change (#1308) intended to move some future-handling logic into a lock context, but actually ended up duplicating it instead. The result is a resource leak in the Waitable's _futures list since the future is added twice but only removed once. This fixes that by removing the duplicated logic outside of the lock. It also preserves the explicit typing annotation on the future.

Is this user-facing behavior change?

No

Did you use Generative AI?

No

Additional Information

A recent change intended to move this logic into a lock context, but
actually ended up duplicating it instead. This fixes that by removing
the duplicated logic outside of the lock. It also preserves the explicit
typing annotation on the future.

Signed-off-by: Nathan Wiebe Neufeldt <[email protected]>
@ahcorde ahcorde requested a review from fujitatomoya October 24, 2025 20:30
Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nwn really appreciate the PR, this look pretty much regression from #1308 as you reported.

lgtm with green CI.

@fujitatomoya
Copy link
Collaborator

@jmblixt3 can you also take a look?

Copy link
Contributor

@jmblixt3 jmblixt3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I think this got introduced since this got rebased so many times.

@jmblixt3
Copy link
Contributor

Will need to backported to all versions as well.

@fujitatomoya
Copy link
Collaborator

@jmblixt3 thank for the review, yeah it took a really long time to put it in, sorry about that.

@fujitatomoya
Copy link
Collaborator

fujitatomoya commented Oct 27, 2025

Pulls: #1532
Gist: https://gist.githubusercontent.com/fujitatomoya/a4693dc537bbd51e8eab2b0075deb033/raw/2a74e6fd4249ce17b71fc3b3e455f9ea9e4ddc88/ros2.repos
BUILD args: --packages-above-and-dependencies rclpy
TEST args: --packages-above rclpy
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/17376

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

@fujitatomoya
Copy link
Collaborator

all green, i will go head to merge this.

@fujitatomoya fujitatomoya merged commit 6e22af9 into ros2:rolling Oct 28, 2025
3 checks passed
@fujitatomoya
Copy link
Collaborator

@Mergifyio backport kilted

@mergify
Copy link
Contributor

mergify bot commented Oct 28, 2025

backport kilted

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Oct 28, 2025
A recent change intended to move this logic into a lock context, but
actually ended up duplicating it instead. This fixes that by removing
the duplicated logic outside of the lock. It also preserves the explicit
typing annotation on the future.

Signed-off-by: Nathan Wiebe Neufeldt <[email protected]>
(cherry picked from commit 6e22af9)
@nwn
Copy link
Contributor Author

nwn commented Oct 28, 2025

@fujitatomoya Thanks for merging!

#1308 needed manual backports to humble and jazzy. Let me know if an automated backport for this PR doesn't work and I can create the backports by hand.

@nwn nwn deleted the nwn-fix-action-client-future branch October 28, 2025 18:50
@fujitatomoya
Copy link
Collaborator

@nwn yeah right, thanks for fixing this.

nwn added a commit to nwn/rclpy that referenced this pull request Nov 1, 2025
A recent change intended to move this logic into a lock context, but
actually ended up duplicating it instead. This fixes that by removing
the duplicated logic outside of the lock.

Signed-off-by: Nathan Wiebe Neufeldt <[email protected]>
(cherry picked from commit 6e22af9)
nwn added a commit to nwn/rclpy that referenced this pull request Nov 1, 2025
A recent change intended to move this logic into a lock context, but
actually ended up duplicating it instead. This fixes that by removing
the duplicated logic outside of the lock.

Signed-off-by: Nathan Wiebe Neufeldt <[email protected]>
(cherry picked from commit 6e22af9)
@nwn
Copy link
Contributor Author

nwn commented Nov 1, 2025

I've created manual backports of this change to Humble and Jazzy since the typing annotations here were not present in those versions.

ahcorde pushed a commit that referenced this pull request Nov 4, 2025
A recent change intended to move this logic into a lock context, but
actually ended up duplicating it instead. This fixes that by removing
the duplicated logic outside of the lock.


(cherry picked from commit 6e22af9)

Signed-off-by: Nathan Wiebe Neufeldt <[email protected]>
ahcorde pushed a commit that referenced this pull request Nov 4, 2025
A recent change intended to move this logic into a lock context, but
actually ended up duplicating it instead. This fixes that by removing
the duplicated logic outside of the lock.


(cherry picked from commit 6e22af9)

Signed-off-by: Nathan Wiebe Neufeldt <[email protected]>
ahcorde pushed a commit that referenced this pull request Nov 4, 2025
A recent change intended to move this logic into a lock context, but
actually ended up duplicating it instead. This fixes that by removing
the duplicated logic outside of the lock. It also preserves the explicit
typing annotation on the future.


(cherry picked from commit 6e22af9)

Signed-off-by: Nathan Wiebe Neufeldt <[email protected]>
Co-authored-by: Nathan Wiebe Neufeldt <[email protected]>
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