Skip to content

Fix ABBA deadlock between waitForTransform and testTransformableRequests (backport #982) - #987

Open
mergify[bot] wants to merge 1 commit into
lyricalfrom
mergify/bp/lyrical/pr-982
Open

Fix ABBA deadlock between waitForTransform and testTransformableRequests (backport #982)#987
mergify[bot] wants to merge 1 commit into
lyricalfrom
mergify/bp/lyrical/pr-982

Conversation

@mergify

@mergify mergify Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Description

As mentioned in #979, an ABBA deadlock situation was introduced in #966 where testTransformableRequests() locks transformable_requests_mutex_ and tries to run cb which requires timer_to_request_map_mutex_ while parallely waitForTransform acquires timer_to_request_map_mutex_ and tries to call addTransformableRequest which internally needs transformable_requests_mutex_ resulting in ABBA situation.

My apologies for not noticing this issue previously and a special thanks to @jplapp and @mini-1235 for bringing it to my attention.

@mini-1235 has already opened #979 to fix this issue. I agree with the approach in that PR (to unlock mutex before running callbacks and lock again) but I think restarting the i and going through the beginning of the requests for every callback would add unnecessary computation time. More precisely, the cost is that if M callbacks fire per setTransform and N requests are pending, you get O(M·N) work instead of O(N).

I tried to improve that by going through the requests first, extracting the pending callbacks and then running them. That way we keep the swap-and-pop behavior as before.

I have also copied the test @jplapp added in #980 here as well. @mini-1235 could you please also check this in your nav2 setup where this problem became highlighted?

Credits to @jplap and @mini-1235 for their idea and suggested changes.

Did you use Generative AI?

Yes, Claude Sonned 4.6


This is an automatic backport of pull request #982 done by [Mergify](https://mergify.com).

@ahcorde

ahcorde commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Pulls: #987
Gist: https://gist.githubusercontent.com/ahcorde/c6e4be3464e44755860cffed4336b638/raw/1094d0868ff2bfbe551facc648ea60708931f926/ros2.repos
BUILD args: --packages-above-and-dependencies tf2 tf2_ros
TEST args: --packages-above tf2 tf2_ros
ROS Distro: lyrical
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/20357

  • 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.

2 participants