Skip to content

Add regression test for waitForTransform/testTransformableRequests deadlock - #980

Closed
jplapp wants to merge 1 commit into
ros2:rollingfrom
logivations:regression-test-waitfortransform-deadlock-rolling
Closed

jplapp wants to merge 1 commit into
ros2:rollingfrom
logivations:regression-test-waitfortransform-deadlock-rolling

Conversation

@jplapp

@jplapp jplapp commented Aug 26, 2026 •

Copy link
Copy Markdown

Description

The test forces the interleaving deterministically:

  1. Register a plain BufferCore::addTransformableRequest("foo"→"bar", t=1s) whose callback, when fired, spawns a thread that calls buffer.waitForTransform("foo"→"other", …) and then sleeps 50 ms before returning.
  2. Call buffer.waitForTransform("foo"→"bar", t=1s, cb)
  3. In another thread publish the transform: call buffer.setTransform(foo→bar @1s).

This leads to the deadlock with #966, and works fine before, and also works fine with #966 + #979

Relates to #966

Is this user-facing behavior change?

Did you use Generative AI?

grok 4.6 + claude fable 5

Additional Information

…adlock

Since ros2#966 (jazzy: ros2#973) tf2_ros::Buffer::waitForTransform holds
timer_to_request_map_mutex_ while calling
BufferCore::addTransformableRequest, which takes
transformable_requests_mutex_. BufferCore::testTransformableRequests
holds transformable_requests_mutex_ while invoking the ready-callback,
which takes timer_to_request_map_mutex_. The two lock orders form an
ABBA deadlock; in Nav2 every costmap callback group freezes shortly
after start-up.

The test forces the interleaving deterministically: a transformable
callback (running inside testTransformableRequests) starts a thread
that enters waitForTransform and blocks in addTransformableRequest;
when the callback returns, the next ready request's callback needs
timer_to_request_map_mutex_ and deadlocks. Fails on jazzy HEAD, passes
on 0.36.22 and with ros2#979 applied.

(cherry picked from commit 54daeda)
@alireza-moayyedi

Copy link
Copy Markdown
Contributor

If you don't mind, I have included your test in #982.

@skyegalaxy
skyegalaxy requested a review from ahcorde September 3, 2026 16:37
@jplapp

jplapp commented Sep 7, 2026

Copy link
Copy Markdown
Author

sure, thanks a lot for the quick response! Closing this then

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