Skip to content

TSan lock-order-inversion reproducible via Nav2 test_bond #3232

Description

@hu1097007701

Generated by Generative AI

No response

Operating System:

Linux hwk-MS-7D99 7.0.0-28-generic #28~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 15:50:57 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux

ROS version or commit hash:

jazzy

RMW implementation (if applicable):

rmw_fastrtps_cpp

RMW Configuration (if applicable):

No response

Client library (if applicable):

rclcpp

'ros2 doctor --report' output

ros2 doctor --report
NETWORK CONFIGURATION
error   : Unable to access network interface information: [Errno 1] Operation not permitted

PLATFORM INFORMATION
system           : Linux
platform info    : Linux-7.0.0-28-generic-x86_64-with-glibc2.39
release          : 7.0.0-28-generic
processor        : x86_64

RMW MIDDLEWARE
middleware name    : rmw_fastrtps_cpp

Steps to reproduce issue

  1. Build nav2_util and nav2_lifecycle_manager with ThreadSanitizer enabled.
  2. Run Nav2's built-in test_bond test.

Example:

source /opt/ros/jazzy/setup.bash
cd /home/hwk/nav2_ws

colcon build \
  --packages-select nav2_util nav2_lifecycle_manager \
  --cmake-clean-cache \
  --parallel-workers 1 \
  --cmake-args \
    -DBUILD_TESTING=ON \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DCMAKE_C_FLAGS="-O1 -g -w -Wno-error -fno-omit-frame-pointer -fsanitize=thread" \
    -DCMAKE_CXX_FLAGS="-O1 -g -w -Wno-error -fno-omit-frame-pointer -fsanitize=thread" \
    -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread" \
    -DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=thread"

source /home/hwk/nav2_ws/install/setup.bash

export CTEST_OUTPUT_ON_FAILURE=1
export TSAN_OPTIONS="halt_on_error=0 history_size=7 second_deadlock_stack=1 report_signal_unsafe=0"

cd /home/hwk/nav2_ws/build/nav2_lifecycle_manager
ctest -V -R test_bond

Expected behavior

The test should complete without any ThreadSanitizer lock-order-inversion warning.

Actual behavior

The test logic appears to pass, but TSan reports a lock-order-inversion warning and the test run fails because of the sanitizer report.

The warning summary includes:

  • rclcpp::Context::add_on_shutdown_callback(std::function<void ()>)
  • rclcpp::graph_listener::GraphListener::start_if_not_started()
  • rclcpp::graph_listener::GraphListener::__shutdown()

Additional information

The smallest reproducer I found is Nav2's built-in test:

  • nav2_lifecycle_manager/test/test_bond.cpp

The call path on the reproducer side includes:

  • LifecycleBondTest.POSITIVE
  • nav2_lifecycle_manager::LifecycleManagerClient::startup()

I can also provide the full TSan log if that would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions