Skip to content

Improve tf2_ros::MessageFilter test reliability#929

Open
mjcarroll wants to merge 2 commits intoros2:rollingfrom
mjcarroll:fix-message-filter-test-flakiness
Open

Improve tf2_ros::MessageFilter test reliability#929
mjcarroll wants to merge 2 commits intoros2:rollingfrom
mjcarroll:fix-message-filter-test-flakiness

Conversation

@mjcarroll
Copy link
Copy Markdown
Member

@mjcarroll mjcarroll commented Apr 28, 2026

Description

This PR addresses flaky timeouts and message drops in tf2_ros::MessageFilter tests, specifically identifying the root causes for geometry2#846.

Improvements

  1. Unique Node Names: Appended the test case name to the node name to prevent discovery collisions when multiple test processes run on the same network.
  2. Explicit Discovery Synchronization: Added a wait loop that checks buffer.canTransform before starting the main message publication loop. This ensures that the TransformListener has actually received the static transforms from the broadcaster.
  3. Robust Execution Model: Replaced the sparse spin_some() + sleep(1s) loop with a higher-frequency spin/sleep cycle. This ensures that internal tf2_ros::Buffer timers and MessageFilter callbacks are processed promptly, preventing the message queue (depth 10) from filling up under high load.
  4. Clock Consistency: Ensured the same clock instance is used for generating message timestamps and the tf2 buffer.

Fixes #846

Is this user-facing behavior change?

No, test-only changes.

Did you use Generative AI?

Yes. Gemini CLI:2.0-Flash [web_fetch, run_shell_command, replace, git, gh]

1. Use unique node names for each test case to avoid discovery collisions on high-load CI systems.

2. Synchronize on transform availability before starting the message loop. This ensures that the TransformListener has received the static transforms.

3. Use a more robust execution model by increasing the spin frequency and duration during the test loop.

4. Ensure the same clock instance is used for messages and the buffer.

Fixes ros2#846

Assisted-by: Gemini CLI:2.0-Flash
@mjcarroll
Copy link
Copy Markdown
Member Author

@ahcorde the test itself is actually deprecated... I suppose we could just remove it entirely

@mjcarroll
Copy link
Copy Markdown
Member Author

Pulls: #929
Gist: https://gist.githubusercontent.com/mjcarroll/449ddae5ce690d0a6b9b16dd192ebc4e/raw/e1775296c5f3e9a92b8f3ec406d0aa421261c346/ros2.repos
BUILD args: --packages-above-and-dependencies tf2_ros
TEST args: --packages-above tf2_ros
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/19087

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

Assisted-by: Gemini CLI:2.0-Flash
@ahcorde
Copy link
Copy Markdown
Contributor

ahcorde commented Apr 29, 2026

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

🧑‍🌾 tf2_ros_message_filter.multiple_frames_and_time_tolerance_deprecated timing out flaky in Rolling/Kilted Connext

2 participants