gazebosim / gz-physics

Abstract physics interface designed to support simulation and rapid development of robot applications.
https://gazebosim.org
Apache License 2.0
65 stars 40 forks source link

Seg-faults in tests on macOS Monterey #442

Closed scpeters closed 8 months ago

scpeters commented 1 year ago

Environment

Description

Steps to reproduce

  1. On macOS Monterey:
  2. brew install gz-physics6 -s
  3. `brew test gz-physics6 --debug
  4. When it fails, select option 5 to go to a shell
  5. lldb build/test, then r, then bt
bash-3.2$ lldb ./test
(lldb) target create "./test"
Current executable set to '/private/tmp/gz-physics6-test-20221024-55214-ct6ppk/test' (x86_64).
(lldb) r
Process 55555 launched: '/private/tmp/gz-physics6-test-20221024-55214-ct6ppk/test' (x86_64)
Process 55555 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x1002e7528)
    frame #0: 0x00000001023a0ff7 libdart.6.12.2.dylib`std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> > > >::__deallocate_node(std::__1::__hash_node_base<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, void*>*>*) + 47
libdart.6.12.2.dylib`std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> > > >::__deallocate_node:
->  0x1023a0ff7 <+47>: callq  *0x20(%rax)
    0x1023a0ffa <+50>: testb  $0x1, 0x10(%rbx)
    0x1023a0ffe <+54>: je     0x1023a1009               ; <+65>
    0x1023a1000 <+56>: movq   0x20(%rbx), %rdi
Target 0: (test) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x1002e7528)
  * frame #0: 0x00000001023a0ff7 libdart.6.12.2.dylib`std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> > > >::__deallocate_node(std::__1::__hash_node_base<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, void*>*>*) + 47
    frame #1: 0x00000001023a0faa libdart.6.12.2.dylib`std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> > > >::~__hash_table() + 18
    frame #2: 0x00007ff80118bde4 libsystem_c.dylib`__cxa_finalize_ranges + 409
    frame #3: 0x00007ff80118bbfe libsystem_c.dylib`exit + 35
    frame #4: 0x00007ff80129f375 libdyld.dylib`dyld4::LibSystemHelpers::exit(int) const + 11
    frame #5: 0x0000000100029558 dyld`start + 504
(lldb)

Output

The following tests FAILED:
     11 - UNIT_FindFeatures_TEST (SEGFAULT)
     36 - COMMON_TEST_joint_features_bullet-featherstone (SEGFAULT)
     61 - INTEGRATION_DoublePendulum (SEGFAULT)
$ lldb bin/UNIT_FindFeatures_TEST 
(lldb) target create "bin/UNIT_FindFeatures_TEST"
Current executable set to 'bin/UNIT_FindFeatures_TEST' (x86_64).
(lldb) r
Process 56311 launched: 'bin/UNIT_FindFeatures_TEST' (x86_64)
Running main() from test/gtest_vendor/src/gtest_main.cc
[==========] Running 2 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 2 tests from FindFeatures_TEST
[ RUN      ] FindFeatures_TEST.ForwardStep
[       OK ] FindFeatures_TEST.ForwardStep (1948 ms)
[ RUN      ] FindFeatures_TEST.Unimplemented
Process 56311 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x100394528)
    frame #0: 0x00000001019b34c6 libdart-collision-ode.6.12.2.dylib`std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()>::operator=(std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()>&&) + 46
libdart-collision-ode.6.12.2.dylib`std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()>::operator=:
->  0x1019b34c6 <+46>: callq  *0x20(%rax)
    0x1019b34c9 <+49>: leaq   0x20(%rbx), %rcx
    0x1019b34cd <+53>: movq   0x20(%r14), %rdx
    0x1019b34d1 <+57>: testq  %rdx, %rdx
Target 0: (UNIT_FindFeatures_TEST) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x100394528)
  * frame #0: 0x00000001019b34c6 libdart-collision-ode.6.12.2.dylib`std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()>::operator=(std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()>&&) + 46
    frame #1: 0x00000001019b3066 libdart-collision-ode.6.12.2.dylib`dart::common::FactoryRegistrar<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, dart::collision::CollisionDetector, dart::collision::OdeCollisionDetector, std::__1::shared_ptr<dart::collision::CollisionDetector> >::FactoryRegistrar(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()>) + 84
    frame #2: 0x00000001019b408e libdart-collision-ode.6.12.2.dylib`_GLOBAL__sub_I_OdeCollisionDetector.cpp + 102
    frame #3: 0x00000001000b4e4f dyld`invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 182
    frame #4: 0x00000001000dbaad dyld`invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 242
    frame #5: 0x00000001000d2e26 dyld`invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 557
    frame #6: 0x00000001000a1db3 dyld`dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 129
    frame #7: 0x00000001000d2bb7 dyld`dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 179
    frame #8: 0x00000001000db604 dyld`dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 466
    frame #9: 0x00000001000b4d82 dyld`dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 144
    frame #10: 0x00000001000b4f0e dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 178
    frame #11: 0x00000001000b4ef1 dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 149
    frame #12: 0x00000001000b4fb2 dyld`dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 108
    frame #13: 0x00000001000c3e00 dyld`dyld4::APIs::dlopen_from(char const*, int, void*) + 592
    frame #14: 0x00000001002a79f7 libgz-plugin2-loader.2.dylib`gz::plugin::Loader::Implementation::LoadLib(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) + 65
    frame #15: 0x00000001002a77a6 libgz-plugin2-loader.2.dylib`gz::plugin::Loader::LoadLib(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) + 56
    frame #16: 0x00000001002a7764 libgz-plugin2-loader.2.dylib`gz::plugin::Loader::LoadLib(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 16
    frame #17: 0x0000000100004ea9 UNIT_FindFeatures_TEST`PrimeTheLoader(_loader=0x00007ff7bfeff438) at TestUtilities.hh:48:15 [opt]
    frame #18: 0x000000010000557f UNIT_FindFeatures_TEST`FindFeatures_TEST_Unimplemented_Test::TestBody(this=<unavailable>) at FindFeatures_TEST.cc:63:3 [opt]
    frame #19: 0x0000000100023818 UNIT_FindFeatures_TEST`void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) [inlined] void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(object=<unavailable>, method=<unavailable>, location="the test body")(), char const*) at gtest.cc:2599:10 [opt]
    frame #20: 0x0000000100023806 UNIT_FindFeatures_TEST`void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(object=0x000060000000d130, method=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00, location="the test body")(), char const*) at gtest.cc:2635:14 [opt]
    frame #21: 0x0000000100023776 UNIT_FindFeatures_TEST`testing::Test::Run(this=0x000060000000d130) at gtest.cc:2674:5 [opt]
    frame #22: 0x0000000100024b2b UNIT_FindFeatures_TEST`testing::TestInfo::Run(this=0x0000000100504510) at gtest.cc:2853:11 [opt]
    frame #23: 0x0000000100025707 UNIT_FindFeatures_TEST`testing::TestSuite::Run(this=0x00000001005043f0) at gtest.cc:3012:30 [opt]
    frame #24: 0x0000000100035e37 UNIT_FindFeatures_TEST`testing::internal::UnitTestImpl::RunAllTests(this=<unavailable>) at gtest.cc:5870:44 [opt]
    frame #25: 0x00000001000350e8 UNIT_FindFeatures_TEST`bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) [inlined] bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(object=<unavailable>, method=<unavailable>, location="auxiliary test code (environments or event listeners)")(), char const*) at gtest.cc:2599:10 [opt]
    frame #26: 0x00000001000350d6 UNIT_FindFeatures_TEST`bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(object=<unavailable>, method=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00, location="auxiliary test code (environments or event listeners)")(), char const*) at gtest.cc:2635:14 [opt]
    frame #27: 0x000000010003506c UNIT_FindFeatures_TEST`testing::UnitTest::Run(this=0x0000000100050540) at gtest.cc:5444:10 [opt]
    frame #28: 0x0000000100041b2a UNIT_FindFeatures_TEST`main [inlined] RUN_ALL_TESTS() at gtest.h:2293:73 [opt]
    frame #29: 0x0000000100041b1d UNIT_FindFeatures_TEST`main(argc=1, argv=<unavailable>) at gtest_main.cc:51:10 [opt]
    frame #30: 0x00000001000a552e dyld`start + 462
(lldb)
$ lldb bin/INTEGRATION_DoublePendulum 
(lldb) target create "bin/INTEGRATION_DoublePendulum"
Current executable set to 'bin/INTEGRATION_DoublePendulum' (x86_64).
(lldb) r
Process 56318 launched: 'bin/INTEGRATION_DoublePendulum' (x86_64)
Running main() from test/gtest_vendor/src/gtest_main.cc
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from DoublePendulum
[ RUN      ] DoublePendulum.Step
DoublePendulum: testing plugin: mock::dart::DARTDoublePendulum
Warning: link 'link1' material 'black' undefined.
         at line 84 in /tmp/urdfdom-20211203-49678-1o3gd7o/urdfdom-3.0.0/urdf_parser/src/model.cpp
Warning: link 'link1' material 'black' undefined.
         at line 84 in /tmp/urdfdom-20211203-49678-1o3gd7o/urdfdom-3.0.0/urdf_parser/src/model.cpp
Warning: link 'link2' material 'orange' undefined.
         at line 84 in /tmp/urdfdom-20211203-49678-1o3gd7o/urdfdom-3.0.0/urdf_parser/src/model.cpp
Warning: link 'link2' material 'orange' undefined.
         at line 84 in /tmp/urdfdom-20211203-49678-1o3gd7o/urdfdom-3.0.0/urdf_parser/src/model.cpp
2022-10-24 20:49:39.444487-0700 INTEGRATION_DoublePendulum[56318:234810] dynamic_cast error 2: One or more of the following type_info's has hidden visibility or is defined in more than one translation unit. They should all have public visibility. N4urdf8GeometryE, N4urdf3BoxE, N4urdf6SphereE.
2022-10-24 20:49:39.444707-0700 INTEGRATION_DoublePendulum[56318:234810] dynamic_cast error 2: One or more of the following type_info's has hidden visibility or is defined in more than one translation unit. They should all have public visibility. N4urdf8GeometryE, N4urdf3BoxE, N4urdf3BoxE.
2022-10-24 20:49:39.444772-0700 INTEGRATION_DoublePendulum[56318:234810] dynamic_cast error 2: One or more of the following type_info's has hidden visibility or is defined in more than one translation unit. They should all have public visibility. N4urdf8GeometryE, N4urdf3BoxE, N4urdf6SphereE.
2022-10-24 20:49:39.444823-0700 INTEGRATION_DoublePendulum[56318:234810] dynamic_cast error 2: One or more of the following type_info's has hidden visibility or is defined in more than one translation unit. They should all have public visibility. N4urdf8GeometryE, N4urdf3BoxE, N4urdf6SphereE.
[       OK ] DoublePendulum.Step (346 ms)
[----------] 1 test from DoublePendulum (346 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (346 ms total)
[  PASSED  ] 1 test.
Process 56318 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x100388528)
    frame #0: 0x0000000102355ff7 libdart.6.12.2.dylib`std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> > > >::__deallocate_node(std::__1::__hash_node_base<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, void*>*>*) + 47
libdart.6.12.2.dylib`std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> > > >::__deallocate_node:
->  0x102355ff7 <+47>: callq  *0x20(%rax)
    0x102355ffa <+50>: testb  $0x1, 0x10(%rbx)
    0x102355ffe <+54>: je     0x102356009               ; <+65>
    0x102356000 <+56>: movq   0x20(%rbx), %rdi
Target 0: (INTEGRATION_DoublePendulum) stopped.
(lldb) thread backtrace all
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x100388528)
  * frame #0: 0x0000000102355ff7 libdart.6.12.2.dylib`std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> > > >::__deallocate_node(std::__1::__hash_node_base<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, void*>*>*) + 47
    frame #1: 0x0000000102355faa libdart.6.12.2.dylib`std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<std::__1::shared_ptr<dart::collision::CollisionDetector> ()> > > >::~__hash_table() + 18
    frame #2: 0x00007ff80118bde4 libsystem_c.dylib`__cxa_finalize_ranges + 409
    frame #3: 0x00007ff80118bbfe libsystem_c.dylib`exit + 35
    frame #4: 0x00007ff80129f375 libdyld.dylib`dyld4::LibSystemHelpers::exit(int) const + 11
    frame #5: 0x00000001000c9558 dyld`start + 504
(lldb)
scpeters commented 1 year ago

currently blocking monterey bottles for gz-physics6 in https://github.com/osrf/homebrew-simulation/pull/2089

j-rivero commented 1 year ago

Could be something related to?

2022-10-24 20:49:39.444823-0700 INTEGRATION_DoublePendulum[56318:234810] dynamic_cast error 2: One or more of the following type_info's has hidden visibility or is defined in more than one translation unit. They should all have public visibility. N4urdf8GeometryE, N4urdf3BoxE, N4urdf6SphereE.

j-rivero commented 1 year ago

re-reading seems more related to libdart-collision-ode.6.12.2 when using the CollisionDetector:

frame #0: 0x00000001019b34c6 libdart-collision-ode.6.12.2.dylib`std::1::function<std::1::shared_ptr ()>::operator=(std::1::function<std::1::shared_ptr ()>&&) + 46

mjcarroll commented 1 year ago

@scpeters are you looking into this?

scpeters commented 1 year ago

@scpeters are you looking into this?

I upgraded my laptop to Monterey, but I don't know how to proceed with this issue. I am not actively investigating it but am happy to test debugging ideas that people propose

scpeters commented 1 year ago

some analysis of these build failures and backtraces:

INTEGRATION_DoublePendulum

This test has only one test case, which finishes successfully and prints [ PASSED ] 1 test. and then it seg-faults after that point.

UNIT_FindFeatures_TEST

This test has multiple test cases, and the first one passes, but then it seg-faults during the second test case:

[ RUN      ] FindFeatures_TEST.ForwardStep
[       OK ] FindFeatures_TEST.ForwardStep (1948 ms)
[ RUN      ] FindFeatures_TEST.Unimplemented
Process 56311 stopped

Analysis

This looks like an issue with shutdown? Or unloading the plugins?

Crola1702 commented 1 year ago

This is happening on mac.five.monterey (cloud machine). Reference build: gz-physics6-homebrew/61 build

These are the failing tests:

``` The following tests FAILED: 11 - UNIT_FindFeatures_TEST (SEGFAULT) 19 - COMMON_TEST_added_mass_dartsim (SEGFAULT) 27 - COMMON_TEST_addexternalforcetorque_dartsim (SEGFAULT) 35 - COMMON_TEST_basic_test_dartsim (SEGFAULT) 43 - COMMON_TEST_collisions_dartsim (SEGFAULT) 51 - COMMON_TEST_construct_empty_world_dartsim (SEGFAULT) 59 - COMMON_TEST_free_joint_features_dartsim (SEGFAULT) 65 - COMMON_TEST_joint_features_bullet-featherstone (SEGFAULT) 67 - COMMON_TEST_joint_features_dartsim (SEGFAULT) 75 - COMMON_TEST_joint_transmitted_wrench_features_dartsim (SEGFAULT) 83 - COMMON_TEST_kinematic_features_dartsim (SEGFAULT) 91 - COMMON_TEST_link_features_dartsim (SEGFAULT) 99 - COMMON_TEST_shape_features_dartsim (SEGFAULT) 103 - COMMON_TEST_simulation_features_bullet (SEGFAULT) 105 - COMMON_TEST_simulation_features_bullet-featherstone (SEGFAULT) 107 - COMMON_TEST_simulation_features_dartsim (SEGFAULT) 115 - COMMON_TEST_world_features_dartsim (SEGFAULT) ```
srmainwaring commented 1 year ago

This looks like an issue with shutdown? Or unloading the plugins?

Possibly a bit of both. Unloading the dart plugin causes a problem when exiting. Can reproduce with a minimal example:

int main(int argc, const char* argv[])
{
  plugin::Loader loader;
  PrimeTheLoader(loader);
}

where PrimeTheLoader is from TestUtilities.hh.

The tpe plugin does not cause an issue which can be verified by modifying that plugin's CMakeLists.txtto include:

foreach(test UNIT_FindFeatures_TEST UNIT_RequestFeatures_TEST)
  if(TARGET ${test})
    target_compile_definitions(${test} PRIVATE
      "tpe_plugin_LIB=\"$<TARGET_FILE:${tpe_plugin}>\""
    )
  endif()
endforeach()

A work around might be to use the nodelete=true version of gz::plugin::Loader::LoadLib(), but the core problem seems to be with the dart library. It looks as though the destructor code for the CollisionDetector has been unloaded before the Factory goes out of scope (see details).

```bash libdart.6.10.0.dylib!std::__1::__function::__value_func ()>::~__value_func() (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__functional/function.h:464) libdart.6.10.0.dylib!std::__1::__function::__value_func ()>::~__value_func() (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__functional/function.h:462) libdart.6.10.0.dylib!std::__1::function ()>::~function() (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__functional/function.h:1169) libdart.6.10.0.dylib!std::__1::function ()>::~function() (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__functional/function.h:1169) libdart.6.10.0.dylib!std::__1::pair, std::__1::allocator > const, std::__1::function ()> >::~pair() (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__utility/pair.h:42) libdart.6.10.0.dylib!std::__1::pair, std::__1::allocator > const, std::__1::function ()> >::~pair() (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__utility/pair.h:42) libdart.6.10.0.dylib!void std::__1::allocator_traits, std::__1::allocator >, std::__1::function ()> >, void*> > >::destroy, std::__1::allocator > const, std::__1::function ()> >, void, void>(std::__1::allocator, std::__1::allocator >, std::__1::function ()> >, void*> >&, std::__1::pair, std::__1::allocator > const, std::__1::function ()> >*) (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__memory/allocator_traits.h:319) libdart.6.10.0.dylib!std::__1::__hash_table, std::__1::allocator >, std::__1::function ()> >, std::__1::__unordered_map_hasher, std::__1::allocator >, std::__1::__hash_value_type, std::__1::allocator >, std::__1::function ()> >, std::__1::hash, std::__1::allocator > >, std::__1::equal_to, std::__1::allocator > >, true>, std::__1::__unordered_map_equal, std::__1::allocator >, std::__1::__hash_value_type, std::__1::allocator >, std::__1::function ()> >, std::__1::equal_to, std::__1::allocator > >, std::__1::hash, std::__1::allocator > >, true>, std::__1::allocator, std::__1::allocator >, std::__1::function ()> > > >::__deallocate_node(std::__1::__hash_node_base, std::__1::allocator >, std::__1::function ()> >, void*>*>*) (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__hash_table:1580) libdart.6.10.0.dylib!std::__1::__hash_table, std::__1::allocator >, std::__1::function ()> >, std::__1::__unordered_map_hasher, std::__1::allocator >, std::__1::__hash_value_type, std::__1::allocator >, std::__1::function ()> >, std::__1::hash, std::__1::allocator > >, std::__1::equal_to, std::__1::allocator > >, true>, std::__1::__unordered_map_equal, std::__1::allocator >, std::__1::__hash_value_type, std::__1::allocator >, std::__1::function ()> >, std::__1::equal_to, std::__1::allocator > >, std::__1::hash, std::__1::allocator > >, true>, std::__1::allocator, std::__1::allocator >, std::__1::function ()> > > >::~__hash_table() (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__hash_table:1519) libdart.6.10.0.dylib!std::__1::__hash_table, std::__1::allocator >, std::__1::function ()> >, std::__1::__unordered_map_hasher, std::__1::allocator >, std::__1::__hash_value_type, std::__1::allocator >, std::__1::function ()> >, std::__1::hash, std::__1::allocator > >, std::__1::equal_to, std::__1::allocator > >, true>, std::__1::__unordered_map_equal, std::__1::allocator >, std::__1::__hash_value_type, std::__1::allocator >, std::__1::function ()> >, std::__1::equal_to, std::__1::allocator > >, std::__1::hash, std::__1::allocator > >, true>, std::__1::allocator, std::__1::allocator >, std::__1::function ()> > > >::~__hash_table() (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__hash_table:1511) libdart.6.10.0.dylib!std::__1::unordered_map, std::__1::allocator >, std::__1::function ()>, std::__1::hash, std::__1::allocator > >, std::__1::equal_to, std::__1::allocator > >, std::__1::allocator, std::__1::allocator > const, std::__1::function ()> > > >::~unordered_map() (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/unordered_map:1047) libdart.6.10.0.dylib!std::__1::unordered_map, std::__1::allocator >, std::__1::function ()>, std::__1::hash, std::__1::allocator > >, std::__1::equal_to, std::__1::allocator > >, std::__1::allocator, std::__1::allocator > const, std::__1::function ()> > > >::~unordered_map() (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/unordered_map:1045) libdart.6.10.0.dylib!dart::common::Factory, std::__1::allocator >, dart::collision::CollisionDetector, std::__1::shared_ptr >::~Factory() (/Volumes/MacPro2_DV1/Code/osrf/gz_garden_ws/src/dart/dart/common/Factory.hpp:80) libdart.6.10.0.dylib!dart::common::Factory, std::__1::allocator >, dart::collision::CollisionDetector, std::__1::shared_ptr >::~Factory() (/Volumes/MacPro2_DV1/Code/osrf/gz_garden_ws/src/dart/dart/common/Factory.hpp:80) libsystem_c.dylib!__cxa_finalize_ranges (Unknown Source:0) libsystem_c.dylib!exit (Unknown Source:0) libdyld.dylib!dyld4::LibSystemHelpers::exit(int) const (Unknown Source:0) dyld!start (Unknown Source:0) ```

Investigation ongoing...

The destructor that is missing corresponds to the std::function associated with the Creator lambda in this static Registrar variable.

DARTCollisionDetector::Registrar<DARTCollisionDetector>
    DARTCollisionDetector::mRegistrar{
        DARTCollisionDetector::getStaticType(),
        []() -> std::shared_ptr<dart::collision::DARTCollisionDetector> {
          return dart::collision::DARTCollisionDetector::create();
        }};
scpeters commented 1 year ago

while testing #529, I noticed a seg-fault in COMMON_TEST_joint_features_bullet-featherstone in the JointFeaturesAttachDetachTest/0.JointAttachDetachSpawnedModel test case. Here is a snippet of console output just before the failure and a backtrace from lldb:

[----------] 4 tests from JointFeaturesAttachDetachTest/0, where TypeParam = JointFeatureAttachDetachList
[ RUN      ] JointFeaturesAttachDetachTest/0.JointAttachDetach
JointFeaturesTest::GetLibToTest() lib/libgz-physics6-bullet-featherstone-plugin.dylib
Testing plugin: gz::physics::bullet_featherstone::Plugin
[       OK ] JointFeaturesAttachDetachTest/0.JointAttachDetach (133 ms)
[ RUN      ] JointFeaturesAttachDetachTest/0.JointAttachMultiple
JointFeaturesTest::GetLibToTest() lib/libgz-physics6-bullet-featherstone-plugin.dylib
Testing plugin: gz::physics::bullet_featherstone::Plugin
[       OK ] JointFeaturesAttachDetachTest/0.JointAttachMultiple (114 ms)
[ RUN      ] JointFeaturesAttachDetachTest/0.LinkCountsInJointAttachDetach
JointFeaturesTest::GetLibToTest() lib/libgz-physics6-bullet-featherstone-plugin.dylib
Testing plugin: gz::physics::bullet_featherstone::Plugin
[       OK ] JointFeaturesAttachDetachTest/0.LinkCountsInJointAttachDetach (113 ms)
[ RUN      ] JointFeaturesAttachDetachTest/0.JointAttachDetachSpawnedModel
JointFeaturesTest::GetLibToTest() lib/libgz-physics6-bullet-featherstone-plugin.dylib
Testing plugin: gz::physics::bullet_featherstone::Plugin
Process 93698 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x102656ba8)
    frame #0: 0x0000000101013f0f libBulletCollision.3.25.dylib`btCollisionWorld::~btCollisionWorld() + 41
libBulletCollision.3.25.dylib`btCollisionWorld::~btCollisionWorld:
->  0x101013f0f <+41>: movq   0xc8(%r12), %r15
    0x101013f17 <+49>: testq  %r15, %r15
    0x101013f1a <+52>: je     0x101013f57               ; <+113>
    0x101013f1c <+54>: movq   0x68(%r14), %rdi
Target 0: (COMMON_TEST_joint_features) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x102656ba8)
  * frame #0: 0x0000000101013f0f libBulletCollision.3.25.dylib`btCollisionWorld::~btCollisionWorld() + 41
    frame #1: 0x0000000100dd861e libBulletDynamics.3.25.dylib`btMultiBodyDynamicsWorld::~btMultiBodyDynamicsWorld() + 14
    frame #2: 0x00000001060097dd libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::WorldInfo::~WorldInfo() [inlined] std::__1::default_delete<btMultiBodyDynamicsWorld>::operator(this=0x0000600003511c80, __ptr=<unavailable>)[abi:v15006](btMultiBodyDynamicsWorld*) const at unique_ptr.h:48:5 [opt]
    frame #3: 0x00000001060097d7 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::WorldInfo::~WorldInfo() [inlined] std::__1::unique_ptr<btMultiBodyDynamicsWorld, std::__1::default_delete<btMultiBodyDynamicsWorld> >::reset[abi:v15006](this=0x0000600003511c80, __p=0x0000000000000000) at unique_ptr.h:305:7 [opt]
    frame #4: 0x00000001060097c6 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::WorldInfo::~WorldInfo() [inlined] std::__1::unique_ptr<btMultiBodyDynamicsWorld, std::__1::default_delete<btMultiBodyDynamicsWorld> >::~unique_ptr[abi:v15006](this=0x0000600003511c80) at unique_ptr.h:259:19 [opt]
    frame #5: 0x00000001060097c6 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::WorldInfo::~WorldInfo() [inlined] std::__1::unique_ptr<btMultiBodyDynamicsWorld, std::__1::default_delete<btMultiBodyDynamicsWorld> >::~unique_ptr[abi:v15006](this=0x0000600003511c80) at unique_ptr.h:259:17 [opt]
    frame #6: 0x00000001060097c6 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::WorldInfo::~WorldInfo(this=0x0000600003511c48) at Base.hh:64:8 [opt]
    frame #7: 0x0000000106009b98 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Base::~Base() [inlined] std::__1::__shared_count::__release_shared[abi:v15006](this=0x0000600003511c30) at shared_ptr.h:174:9 [opt]
    frame #8: 0x0000000106009b7d libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Base::~Base() [inlined] std::__1::__shared_weak_count::__release_shared[abi:v15006](this=0x0000600003511c30) at shared_ptr.h:215:27 [opt]
    frame #9: 0x0000000106009b7d libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Base::~Base() [inlined] std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo>::~shared_ptr[abi:v15006](this=0x0000600000ca9d28) at shared_ptr.h:702:23 [opt]
    frame #10: 0x0000000106009b74 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Base::~Base() [inlined] std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo>::~shared_ptr[abi:v15006](this=0x0000600000ca9d28) at shared_ptr.h:700:5 [opt]
    frame #11: 0x0000000106009b74 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Base::~Base() [inlined] std::__1::pair<unsigned long const, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> >::~pair(this=0x0000600000ca9d20) at pair.h:40:29 [opt]
    frame #12: 0x0000000106009b74 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Base::~Base() [inlined] std::__1::pair<unsigned long const, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> >::~pair(this=0x0000600000ca9d20) at pair.h:40:29 [opt]
    frame #13: 0x0000000106009b74 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Base::~Base() [inlined] void std::__1::allocator_traits<std::__1::allocator<std::__1::__hash_node<std::__1::__hash_value_type<unsigned long, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> >, void*> > >::destroy[abi:v15006]<std::__1::pair<unsigned long const, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> >, void, void>((null)=0x0000000102204c90, __p=0x0000600000ca9d20) at allocator_traits.h:319:15 [opt]
    frame #14: 0x0000000106009b74 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Base::~Base() at __hash_table:1532:9 [opt]
    frame #15: 0x0000000106009b5e libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Base::~Base() [inlined] std::__1::__hash_table<std::__1::__hash_value_type<unsigned long, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> >, std::__1::__unordered_map_hasher<unsigned long, std::__1::__hash_value_type<unsigned long, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> >, std::__1::hash<unsigned long>, std::__1::equal_to<unsigned long>, true>, std::__1::__unordered_map_equal<unsigned long, std::__1::__hash_value_type<unsigned long, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> >, std::__1::equal_to<unsigned long>, std::__1::hash<unsigned long>, true>, std::__1::allocator<std::__1::__hash_value_type<unsigned long, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> > > >::~__hash_table(this=0x0000000102204c80) at __hash_table:1473:5 [opt]
    frame #16: 0x0000000106009b58 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Base::~Base() [inlined] std::__1::__hash_table<std::__1::__hash_value_type<unsigned long, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> >, std::__1::__unordered_map_hasher<unsigned long, std::__1::__hash_value_type<unsigned long, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> >, std::__1::hash<unsigned long>, std::__1::equal_to<unsigned long>, true>, std::__1::__unordered_map_equal<unsigned long, std::__1::__hash_value_type<unsigned long, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> >, std::__1::equal_to<unsigned long>, std::__1::hash<unsigned long>, true>, std::__1::allocator<std::__1::__hash_value_type<unsigned long, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> > > >::~__hash_table(this=0x0000000102204c80) at __hash_table:1465:1 [opt]
    frame #17: 0x0000000106009b58 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Base::~Base() [inlined] std::__1::unordered_map<unsigned long, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo>, std::__1::hash<unsigned long>, std::__1::equal_to<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> > > >::~unordered_map[abi:v15006](this=0x0000000102204c80 size=1) at unordered_map:1153:5 [opt]
    frame #18: 0x0000000106009b58 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Base::~Base() [inlined] std::__1::unordered_map<unsigned long, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo>, std::__1::hash<unsigned long>, std::__1::equal_to<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::shared_ptr<gz::physics::bullet_featherstone::WorldInfo> > > >::~unordered_map[abi:v15006](this=0x0000000102204c80 size=1) at unordered_map:1151:22 [opt]
    frame #19: 0x0000000106009b58 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Base::~Base(this=0x0000000102204c70, vtt=<unavailable>) at Base.hh:254:7 [opt]
    frame #20: 0x00000001060279a4 libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Plugin::~Plugin() [inlined] gz::physics::bullet_featherstone::Plugin::~Plugin(this=0x0000000102204b30) at plugin.cc:50:7 [opt]
    frame #21: 0x000000010602791a libgz-physics6-bullet-featherstone-plugin.6.4.0.dylib`gz::physics::bullet_featherstone::Plugin::~Plugin(this=0x0000000102204b30) at plugin.cc:50:7 [opt]
    frame #22: 0x0000000100243c59 libgz-plugin2.2.dylib`gz::plugin::PluginWithDlHandle::~PluginWithDlHandle() + 45
    frame #23: 0x0000000100243d91 libgz-plugin2.2.dylib`std::__1::shared_ptr<void>::~shared_ptr() + 49
    frame #24: 0x0000000100243307 libgz-plugin2.2.dylib`gz::plugin::Plugin::~Plugin() + 51
    frame #25: 0x000000010003d112 COMMON_TEST_joint_features`gz::plugin::detail::SelectSpecializers<gz::physics::detail::ComposePlugin<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList, void>::type>::~SelectSpecializers() [inlined] gz::plugin::detail::SelectSpecializers<gz::physics::detail::ComposePlugin<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList, void>::type>::~SelectSpecializers(this=0x00006000017185c0) at SpecializedPlugin.hh:205:55 [opt]
    frame #26: 0x000000010003d109 COMMON_TEST_joint_features`gz::plugin::detail::SelectSpecializers<gz::physics::detail::ComposePlugin<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList, void>::type>::~SelectSpecializers(this=0x00006000017185c0) at SpecializedPlugin.hh:205:55 [opt]
    frame #27: 0x0000000100046e10 COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] std::__1::__shared_count::__release_shared[abi:v15006](this=0x0000600000268060) at shared_ptr.h:174:9 [opt]
    frame #28: 0x0000000100046dfc COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] std::__1::__shared_weak_count::__release_shared[abi:v15006](this=0x0000600000268060) at shared_ptr.h:215:27 [opt]
    frame #29: 0x0000000100046dfc COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] std::__1::shared_ptr<gz::plugin::TemplatePluginPtr<gz::physics::detail::DeterminePlugin<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList>::Specializer> >::~shared_ptr[abi:v15006](this=0x00007ff7bfeff000) at shared_ptr.h:702:23 [opt]
    frame #30: 0x0000000100046de9 COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] std::__1::shared_ptr<gz::plugin::TemplatePluginPtr<gz::physics::detail::DeterminePlugin<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList>::Specializer> >::~shared_ptr[abi:v15006](this=0x00007ff7bfeff000) at shared_ptr.h:700:5 [opt]
    frame #31: 0x0000000100046de9 COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] gz::physics::Entity<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList>::~Entity(this=0x00007ff7bfefeff8) at Entity.hh:295:41 [opt]
    frame #32: 0x0000000100046da8 COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] gz::physics::World<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList>::~World(this=0x00007ff7bfefeff0) at FeatureList.hh:694:5 [opt]
    frame #33: 0x0000000100046da8 COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] std::__1::__optional_destruct_base<gz::physics::World<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList>, false>::~__optional_destruct_base[abi:v15006](this=0x00007ff7bfefeff0) at optional:261:21 [opt]
    frame #34: 0x0000000100046d9f COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] std::__1::__optional_storage_base<gz::physics::World<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList>, false>::~__optional_storage_base(this=0x00007ff7bfefeff0) at optional:335:8 [opt]
    frame #35: 0x0000000100046d9f COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] std::__1::__optional_copy_base<gz::physics::World<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList>, false>::~__optional_copy_base(this=0x00007ff7bfefeff0) at optional:508:8 [opt]
    frame #36: 0x0000000100046d9f COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] std::__1::__optional_move_base<gz::physics::World<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList>, false>::~__optional_move_base(this=0x00007ff7bfefeff0) at optional:536:8 [opt]
    frame #37: 0x0000000100046d9f COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] std::__1::__optional_copy_assign_base<gz::physics::World<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList>, false>::~__optional_copy_assign_base(this=0x00007ff7bfefeff0) at optional:569:8 [opt]
    frame #38: 0x0000000100046d9f COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] std::__1::__optional_move_assign_base<gz::physics::World<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList>, false>::~__optional_move_assign_base(this=0x00007ff7bfefeff0) at optional:601:8 [opt]
    frame #39: 0x0000000100046d9f COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] std::__1::optional<gz::physics::World<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList> >::~optional(this= Has Value=true ) at optional:644:7 [opt]
    frame #40: 0x0000000100046d9f COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] std::__1::optional<gz::physics::World<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList> >::~optional(this= Has Value=true ) at optional:644:7 [opt]
    frame #41: 0x0000000100046d9f COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] gz::physics::EntityPtr<gz::physics::World<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList> >::~EntityPtr(this=0x00007ff7bfefeff0) at Entity.hh:47:36 [opt]
    frame #42: 0x0000000100046d9f COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody() [inlined] gz::physics::EntityPtr<gz::physics::World<gz::physics::FeaturePolicy<double, 3ul>, JointFeatureAttachDetachList> >::~EntityPtr(this=0x00007ff7bfefeff0) at Entity.hh:47:36 [opt]
    frame #43: 0x0000000100046d9f COMMON_TEST_joint_features`JointFeaturesAttachDetachTest_JointAttachDetachSpawnedModel_Test<JointFeatureAttachDetachList>::TestBody(this=0x0000600000e64000) at joint_features.cc:1489:1 [opt]
    frame #44: 0x0000000100066251 COMMON_TEST_joint_features`void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) [inlined] void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(object=<unavailable>, method=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00, location="the test body")(), char const*) at gtest.cc:2599:10 [opt]
    frame #45: 0x000000010006623f COMMON_TEST_joint_features`void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(object=0x0000600000e64000, method=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00, location="the test body")(), char const*) at gtest.cc:2635:14 [opt]
    frame #46: 0x00000001000661b6 COMMON_TEST_joint_features`testing::Test::Run(this=0x0000600000e64000) at gtest.cc:2674:5 [opt]
    frame #47: 0x00000001000674db COMMON_TEST_joint_features`testing::TestInfo::Run(this=0x0000000100b05f30) at gtest.cc:2853:11 [opt]
    frame #48: 0x0000000100068127 COMMON_TEST_joint_features`testing::TestSuite::Run(this=0x0000000100b05bf0) at gtest.cc:3012:30 [opt]
    frame #49: 0x0000000100077fe7 COMMON_TEST_joint_features`testing::internal::UnitTestImpl::RunAllTests(this=0x0000000100b049d0) at gtest.cc:5870:44 [opt]
    frame #50: 0x00000001000773b1 COMMON_TEST_joint_features`bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) [inlined] bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(object=<unavailable>, method=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00, location="auxiliary test code (environments or event listeners)")(), char const*) at gtest.cc:2599:10 [opt]
    frame #51: 0x000000010007739f COMMON_TEST_joint_features`bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(object=<unavailable>, method=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00, location="auxiliary test code (environments or event listeners)")(), char const*) at gtest.cc:2635:14 [opt]
    frame #52: 0x000000010007733c COMMON_TEST_joint_features`testing::UnitTest::Run(this=0x00000001000ac080) at gtest.cc:5444:10 [opt]
    frame #53: 0x000000010000f0d8 COMMON_TEST_joint_features`main [inlined] RUN_ALL_TESTS() at gtest.h:2293:73 [opt]
    frame #54: 0x000000010000f0cb COMMON_TEST_joint_features`main(argc=<unavailable>, argv=0x00007ff7bfeff688) at joint_features.cc:1610:10 [opt]
    frame #55: 0x00007ff81242f41f dyld`start + 1903
(lldb)
azeey commented 1 year ago

Repeating https://github.com/gazebosim/gz-physics/pull/529#issuecomment-1688350988 for visibility

BTW, I believe the segfaults in bullet-featherstone are due to the order of destruction of unique_ptrs in Base.hh. Bullet seems to have a lot of interdependencies, so deleting objects in the right order is tricky. I have been able to reproduce the problem on linux when running under Valgrind, but I haven't had the chance to fix the issue.

azeey commented 8 months ago

@scpeters, I don't see any segfaults in https://build.osrfoundation.org/view/gz-garden/job/gz_physics-ci-gz-physics6-homebrew-amd64/ or https://build.osrfoundation.org/view/gz-harmonic/job/gz_physics-ci-gz-physics7-homebrew-amd64/. Can this issue be closed?

scpeters commented 8 months ago

yeah, I think the tests have been fixed