Skip to content

AddressSanitizer: new-delete-type-mismatch in rcutils_string_map_fini #365

@tylerjw

Description

@tylerjw

Here is the output from Asan I'm now getting in my tests. I did not have these errors in Galactic but am now experiencing them after upgrading from Galactic on Focal to Rolling on Jammy.

build/core/Testing/20220606-1842/Test.xml: 3 tests, 0 errors, 1 failure, 0 skipped
- test_parameters
  <<< failure message
    -- run_test.py: invoking following command in '/home/runner/work/project/project/.work/target_ws/build/core':
     - /home/runner/work/project/project/.work/target_ws/build/core/test_parameters -r junit -o /home/runner/work/project/project/.work/target_ws/build/core/test_results/core/test_parameters.catch2.xml
    =================================================================
    ==8184==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x607000011f20 in thread T0:
      object passed to delete has wrong type:
      size of the allocated type:   72 bytes;
      size of the deallocated type: 1 bytes.
        #0 0x7fee6b27a22f in operator delete(void*, unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:172
        #1 0x7fee6ac52dae in rcutils_string_map_fini (/opt/ros/rolling/lib/librcutils.so+0x9dae)
        #2 0x7fee6ae753a5  (/opt/ros/rolling/lib/librcl.so+0x233a5)
        #3 0x7fee6ae756c7 in rcl_node_resolve_name (/opt/ros/rolling/lib/librcl.so+0x236c7)
        #4 0x7fee6ae75898 in rcl_publisher_init (/opt/ros/rolling/lib/librcl.so+0x23898)
        #5 0x7fee6afd932d in rclcpp::PublisherBase::PublisherBase(rclcpp::node_interfaces::NodeBaseInterface*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rosidl_message_type_support_t const&, rcl_publisher_options_s const&) (/opt/ros/rolling/lib/librclcpp.so+0x14232d)
        #6 0x7fee6afac7fb  (/opt/ros/rolling/lib/librclcpp.so+0x1157fb)
        #7 0x7fee6afacf30 in std::_Function_handler<std::shared_ptr<rclcpp::PublisherBase> (rclcpp::node_interfaces::NodeBaseInterface*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::QoS const&), rclcpp::create_publisher_factory<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> >, std::allocator<void>, rclcpp::Publisher<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> >, std::allocator<void> > >(rclcpp::PublisherOptionsWithAllocator<std::allocator<void> > const&)::{lambda(rclcpp::node_interfaces::NodeBaseInterface*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::QoS const&)#1}>::_M_invoke(std::_Any_data const&, rclcpp::node_interfaces::NodeBaseInterface*&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::QoS const&) (/opt/ros/rolling/lib/librclcpp.so+0x115f30)
        #8 0x7fee6af9a2ce in rclcpp::node_interfaces::NodeParameters::NodeParameters(std::shared_ptr<rclcpp::node_interfaces::NodeBaseInterface>, std::shared_ptr<rclcpp::node_interfaces::NodeLoggingInterface>, std::shared_ptr<rclcpp::node_interfaces::NodeTopicsInterface>, std::shared_ptr<rclcpp::node_interfaces::NodeServicesInterface>, std::shared_ptr<rclcpp::node_interfaces::NodeClockInterface>, std::vector<rclcpp::Parameter, std::allocator<rclcpp::Parameter> > const&, bool, bool, rclcpp::QoS const&, rclcpp::PublisherOptionsBase const&, bool, bool) (/opt/ros/rolling/lib/librclcpp.so+0x1032ce)
        #9 0x7fee6af92c95 in rclcpp::Node::Node(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::NodeOptions const&) (/opt/ros/rolling/lib/librclcpp.so+0xfbc95)
        #10 0x7fee6af934c7 in rclcpp::Node::Node(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::NodeOptions const&) (/opt/ros/rolling/lib/librclcpp.so+0xfc4c7)
        #11 0x555af062e6c9 in decltype (::new ((void*)(0)) rclcpp::Node((declval<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)())) std::construct_at<rclcpp::Node, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(rclcpp::Node*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/include/c++/11/bits/stl_construct.h:97
        #12 0x555af062e9dc in void std::allocator_traits<std::allocator<rclcpp::Node> >::construct<rclcpp::Node, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::allocator<rclcpp::Node>&, rclcpp::Node*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/include/c++/11/bits/alloc_traits.h:518
        #13 0x555af062dd8b in std::_Sp_counted_ptr_inplace<rclcpp::Node, std::allocator<rclcpp::Node>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::allocator<rclcpp::Node>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/include/c++/11/bits/shared_ptr_base.h:519
        #14 0x555af062d12b in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<rclcpp::Node, std::allocator<rclcpp::Node>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(rclcpp::Node*&, std::_Sp_alloc_shared_tag<std::allocator<rclcpp::Node> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/include/c++/11/bits/shared_ptr_base.h:650
        #15 0x555af062c9b1 in std::__shared_ptr<rclcpp::Node, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<rclcpp::Node>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::_Sp_alloc_shared_tag<std::allocator<rclcpp::Node> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/include/c++/11/bits/shared_ptr_base.h:1342
        #16 0x555af062ab37 in std::shared_ptr<rclcpp::Node>::shared_ptr<std::allocator<rclcpp::Node>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::_Sp_alloc_shared_tag<std::allocator<rclcpp::Node> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/include/c++/11/bits/shared_ptr.h:409
        #17 0x555af06274d2 in std::shared_ptr<rclcpp::Node> std::allocate_shared<rclcpp::Node, std::allocator<rclcpp::Node>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::allocator<rclcpp::Node> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/include/c++/11/bits/shared_ptr.h:863
        #18 0x555af06233f7 in std::shared_ptr<rclcpp::Node> std::make_shared<rclcpp::Node, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/include/c++/11/bits/shared_ptr.h:879
        #19 0x555af0614060 in make_node /home/runner/work/project/project/.work/target_ws/src/project/core/test/test_parameter_loader.cpp:27
        #20 0x555af061507a in C_A_T_C_H_T_E_S_T_0 /home/runner/work/project/project/.work/target_ws/src/project/core/test/test_parameter_loader.cpp:34
        #21 0x555af028e04f in Catch::TestInvokerAsFunction::invoke() const /opt/upstream/install/catch2/include/catch2/catch.hpp:14328
        #22 0x555af028833f in Catch::TestCase::invoke() const /opt/upstream/install/catch2/include/catch2/catch.hpp:14167
        #23 0x555af02651a6 in Catch::RunContext::invokeActiveTestCase() /opt/upstream/install/catch2/include/catch2/catch.hpp:13027
        #24 0x555af02635ca in Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) /opt/upstream/install/catch2/include/catch2/catch.hpp:12992
        #25 0x555af0257f4a in Catch::RunContext::runTest(Catch::TestCase const&) /opt/upstream/install/catch2/include/catch2/catch.hpp:12761
        #26 0x555af02703d7 in execute /opt/upstream/install/catch2/include/catch2/catch.hpp:13354
        #27 0x555af0278ba8 in Catch::Session::runInternal() /opt/upstream/install/catch2/include/catch2/catch.hpp:13560
        #28 0x555af0277151 in Catch::Session::run() /opt/upstream/install/catch2/include/catch2/catch.hpp:13516
        #29 0x555af03dc749 in int Catch::Session::run<char>(int, char const* const*) /opt/upstream/install/catch2/include/catch2/catch.hpp:13238
        #30 0x555af02f77ab in main /home/runner/work/project/project/.work/target_ws/src/project/core/test/main.cpp:14
        #31 0x7fee69ae7d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
        #32 0x7fee69ae7e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
        #33 0x555af01fa464 in _start (/home/runner/work/project/project/.work/target_ws/build/core/test_parameters+0x9a1464)
    0x607000011f20 is located 0 bytes inside of 72-byte region [0x607000011f20,0x607000011f68)
    allocated by thread T0 here:
        #0 0x7fee6b2791c7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
        #1 0x7fee6ac52bb2 in rcutils_string_map_init (/opt/ros/rolling/lib/librcutils.so+0x9bb2)
    SUMMARY: AddressSanitizer: new-delete-type-mismatch ../../../../src/libsanitizer/asan/asan_new_delete.cpp:172 in operator delete(void*, unsigned long)
    ==8184==HINT: if you don't care about these errors you may set ASAN_OPTIONS=new_delete_type_mismatch=0
    ==8184==ABORTING
    -- run_test.py: return code 1
    -- run_test.py: verify result file '/home/runner/work/project/project/.work/target_ws/build/core/test_results/core/test_parameters.catch2.xml'
    Invalid XML in result file '/home/runner/work/project/project/.work/target_ws/build/core/test_results/core/test_parameters.catch2.xml' (even after trying to tidy it): no element found: line 1, column 0
  >>>
build/vision_server/Testing/20220606-1842/Test.xml: 4 tests, 0 errors, 1 failure, 0 skipped
- test_vision_server
  <<< failure message
    -- run_test.py: invoking following command in '/home/runner/work/project/project/.work/target_ws/build/vision_server':
     - /home/runner/work/project/project/.work/target_ws/build/vision_server/test_vision_server -r junit -o /home/runner/work/project/project/.work/target_ws/build/vision_server/test_results/vision_server/test_vision_server.catch2.xml
    =================================================================
    ==8306==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x60700001f580 in thread T0:
      object passed to delete has wrong type:
      size of the allocated type:   72 bytes;
      size of the deallocated type: 1 bytes.
        #0 0x7f12049c022f in operator delete(void*, unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:172
        #1 0x55e07960b27a in __gnu_cxx::new_allocator<char>::deallocate(char*, unsigned long) /usr/include/c++/11/ext/new_allocator.h:145
        #2 0x55e0795a206f in std::allocator<char>::deallocate(char*, unsigned long) /usr/include/c++/11/bits/allocator.h:199
        #3 0x55e0795a206f in std::allocator_traits<std::allocator<char> >::deallocate(std::allocator<char>&, char*, unsigned long) /usr/include/c++/11/bits/alloc_traits.h:496
        #4 0x7f12042450c2 in void rclcpp::allocator::retyped_deallocate<char, std::allocator<char> >(void*, void*) /opt/ros/rolling/include/rclcpp/rclcpp/allocator/allocator_common.hpp:50
        #5 0x7f1202d1bdae in rcutils_string_map_fini (/opt/ros/rolling/lib/librcutils.so+0x9dae)
        #6 0x7f12011423a5  (/opt/ros/rolling/lib/librcl.so+0x233a5)
        #7 0x7f12011426c7 in rcl_node_resolve_name (/opt/ros/rolling/lib/librcl.so+0x236c7)
        #8 0x7f1201142898 in rcl_publisher_init (/opt/ros/rolling/lib/librcl.so+0x23898)
        #9 0x7f1202e6e32d in rclcpp::PublisherBase::PublisherBase(rclcpp::node_interfaces::NodeBaseInterface*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rosidl_message_type_support_t const&, rcl_publisher_options_s const&) (/opt/ros/rolling/lib/librclcpp.so+0x14232d)
        #10 0x7f1202e417fb  (/opt/ros/rolling/lib/librclcpp.so+0x1157fb)
        #11 0x7f1202e41f30 in std::_Function_handler<std::shared_ptr<rclcpp::PublisherBase> (rclcpp::node_interfaces::NodeBaseInterface*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::QoS const&), rclcpp::create_publisher_factory<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> >, std::allocator<void>, rclcpp::Publisher<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> >, std::allocator<void> > >(rclcpp::PublisherOptionsWithAllocator<std::allocator<void> > const&)::{lambda(rclcpp::node_interfaces::NodeBaseInterface*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::QoS const&)#1}>::_M_invoke(std::_Any_data const&, rclcpp::node_interfaces::NodeBaseInterface*&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::QoS const&) (/opt/ros/rolling/lib/librclcpp.so+0x115f30)
        #12 0x7f1202e2f2ce in rclcpp::node_interfaces::NodeParameters::NodeParameters(std::shared_ptr<rclcpp::node_interfaces::NodeBaseInterface>, std::shared_ptr<rclcpp::node_interfaces::NodeLoggingInterface>, std::shared_ptr<rclcpp::node_interfaces::NodeTopicsInterface>, std::shared_ptr<rclcpp::node_interfaces::NodeServicesInterface>, std::shared_ptr<rclcpp::node_interfaces::NodeClockInterface>, std::vector<rclcpp::Parameter, std::allocator<rclcpp::Parameter> > const&, bool, bool, rclcpp::QoS const&, rclcpp::PublisherOptionsBase const&, bool, bool) (/opt/ros/rolling/lib/librclcpp.so+0x1032ce)
        #13 0x7f1202e27c95 in rclcpp::Node::Node(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::NodeOptions const&) (/opt/ros/rolling/lib/librclcpp.so+0xfbc95)
        #14 0x7f1202e284c7 in rclcpp::Node::Node(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::NodeOptions const&) (/opt/ros/rolling/lib/librclcpp.so+0xfc4c7)
        #15 0x55e0797d7797 in decltype (::new ((void*)(0)) rclcpp::Node((declval<char const* const&>)(), (declval<rclcpp::NodeOptions>)())) std::construct_at<rclcpp::Node, char const* const&, rclcpp::NodeOptions>(rclcpp::Node*, char const* const&, rclcpp::NodeOptions&&) /usr/include/c++/11/bits/stl_construct.h:97
        #16 0x55e0797d7947 in void std::allocator_traits<std::allocator<rclcpp::Node> >::construct<rclcpp::Node, char const* const&, rclcpp::NodeOptions>(std::allocator<rclcpp::Node>&, rclcpp::Node*, char const* const&, rclcpp::NodeOptions&&) /usr/include/c++/11/bits/alloc_traits.h:518
        #17 0x55e0797d673e in std::_Sp_counted_ptr_inplace<rclcpp::Node, std::allocator<rclcpp::Node>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<char const* const&, rclcpp::NodeOptions>(std::allocator<rclcpp::Node>, char const* const&, rclcpp::NodeOptions&&) /usr/include/c++/11/bits/shared_ptr_base.h:519
        #18 0x55e0797d518b in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<rclcpp::Node, std::allocator<rclcpp::Node>, char const* const&, rclcpp::NodeOptions>(rclcpp::Node*&, std::_Sp_alloc_shared_tag<std::allocator<rclcpp::Node> >, char const* const&, rclcpp::NodeOptions&&) /usr/include/c++/11/bits/shared_ptr_base.h:650
        #19 0x55e0797d4333 in std::__shared_ptr<rclcpp::Node, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<rclcpp::Node>, char const* const&, rclcpp::NodeOptions>(std::_Sp_alloc_shared_tag<std::allocator<rclcpp::Node> >, char const* const&, rclcpp::NodeOptions&&) /usr/include/c++/11/bits/shared_ptr_base.h:1342
        #20 0x55e0797d3075 in std::shared_ptr<rclcpp::Node>::shared_ptr<std::allocator<rclcpp::Node>, char const* const&, rclcpp::NodeOptions>(std::_Sp_alloc_shared_tag<std::allocator<rclcpp::Node> >, char const* const&, rclcpp::NodeOptions&&) /usr/include/c++/11/bits/shared_ptr.h:409
        #21 0x55e0797d0e00 in std::shared_ptr<rclcpp::Node> std::allocate_shared<rclcpp::Node, std::allocator<rclcpp::Node>, char const* const&, rclcpp::NodeOptions>(std::allocator<rclcpp::Node> const&, char const* const&, rclcpp::NodeOptions&&) /usr/include/c++/11/bits/shared_ptr.h:863
        #22 0x55e0797ce645 in std::shared_ptr<rclcpp::Node> std::make_shared<rclcpp::Node, char const* const&, rclcpp::NodeOptions>(char const* const&, rclcpp::NodeOptions&&) /usr/include/c++/11/bits/shared_ptr.h:879
        #23 0x55e0797bcb35 in C_A_T_C_H_T_E_S_T_0 /home/runner/work/project/project/.work/target_ws/src/project/vision/vision_server/test/test_vision_system_client.cpp:21
        #24 0x55e0793fab1f in Catch::TestInvokerAsFunction::invoke() const /opt/upstream/install/catch2/include/catch2/catch.hpp:14328
        #25 0x55e0793f4e0f in Catch::TestCase::invoke() const /opt/upstream/install/catch2/include/catch2/catch.hpp:14167
        #26 0x55e0793d1c76 in Catch::RunContext::invokeActiveTestCase() /opt/upstream/install/catch2/include/catch2/catch.hpp:13027
        #27 0x55e0793d009a in Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) /opt/upstream/install/catch2/include/catch2/catch.hpp:12992
        #28 0x55e0793c4a1a in Catch::RunContext::runTest(Catch::TestCase const&) /opt/upstream/install/catch2/include/catch2/catch.hpp:12761
        #29 0x55e0793dcea7 in execute /opt/upstream/install/catch2/include/catch2/catch.hpp:13354
        #30 0x55e0793e5678 in Catch::Session::runInternal() /opt/upstream/install/catch2/include/catch2/catch.hpp:13560
        #31 0x55e0793e3c21 in Catch::Session::run() /opt/upstream/install/catch2/include/catch2/catch.hpp:13516
        #32 0x55e079549219 in int Catch::Session::run<char>(int, char const* const*) /opt/upstream/install/catch2/include/catch2/catch.hpp:13238
        #33 0x55e07946427b in main /home/runner/work/project/project/.work/target_ws/src/project/vision/vision_server/test/main.cpp:14
        #34 0x7f12021abd8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
        #35 0x7f12021abe3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
        #36 0x55e079366f34 in _start (/home/runner/work/project/project/.work/target_ws/build/vision_server/test_vision_server+0x844f34)
    0x60700001f580 is located 0 bytes inside of 72-byte region [0x60700001f580,0x60700001f5c8)
    allocated by thread T0 here:
        #0 0x7f12049bf1c7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
        #1 0x55e0795e1e94 in __gnu_cxx::new_allocator<char>::allocate(unsigned long, void const*) /usr/include/c++/11/ext/new_allocator.h:127
        #2 0x55e07954b115 in std::allocator<char>::allocate(unsigned long) /usr/include/c++/11/bits/allocator.h:185
        #3 0x55e07954b115 in std::allocator_traits<std::allocator<char> >::allocate(std::allocator<char>&, unsigned long) /usr/include/c++/11/bits/alloc_traits.h:464
        #4 0x7f1204244ff9 in void* rclcpp::allocator::retyped_allocate<std::allocator<char> >(unsigned long, void*) /opt/ros/rolling/include/rclcpp/rclcpp/allocator/allocator_common.hpp:39
        #5 0x7f1202d1bbb2 in rcutils_string_map_init (/opt/ros/rolling/lib/librcutils.so+0x9bb2)
    SUMMARY: AddressSanitizer: new-delete-type-mismatch ../../../../src/libsanitizer/asan/asan_new_delete.cpp:172 in operator delete(void*, unsigned long)
    ==8306==HINT: if you don't care about these errors you may set ASAN_OPTIONS=new_delete_type_mismatch=0
    ==8306==ABORTING
    -- run_test.py: return code 1
    -- run_test.py: verify result file 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions