Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_aterm_container data race on vptr (ctor/dtor vs virtual call) #1721

Closed
mlaveaux opened this issue Oct 12, 2023 · 1 comment
Closed

_aterm_container data race on vptr (ctor/dtor vs virtual call) #1721

mlaveaux opened this issue Oct 12, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@mlaveaux
Copy link
Member

mlaveaux commented Oct 12, 2023

See stack trace, reminder for myself.

"Failed" (exit code: 66)
------- Stderr: -------
==================
WARNING: ThreadSanitizer: data race on vptr (ctor/dtor vs virtual call) (pid=1511415)
  Write of size 8 at 0x7fd4f4afd4c8 by thread T1:
    #0 atermpp::detail::_aterm_container::~_aterm_container() /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/include/mcrl2/atermpp/detail/aterm_implementation.h:53:3 (librarytest_mcrl2_atermpp_parallel_container_test+0x1a11e2) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #1 atermpp::vector<atermpp::aterm, std::allocator<atermpp::detail::reference_aterm<atermpp::aterm, void> >, false>::~vector() /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/include/mcrl2/atermpp/standard_containers/vector.h:117:4 (librarytest_mcrl2_atermpp_parallel_container_test+0x14fee8) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #2 parallel_vector::test_method()::$_0::operator()() const /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/test/parallel_container_test.cpp:38:5 (librarytest_mcrl2_atermpp_parallel_container_test+0x14fee8)
    #3 void std::__invoke_impl<void, parallel_vector::test_method()::$_0>(std::__invoke_other, parallel_vector::test_method()::$_0&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:61:14 (librarytest_mcrl2_atermpp_parallel_container_test+0x14fee8)
    #4 std::__invoke_result<parallel_vector::test_method()::$_0>::type std::__invoke<parallel_vector::test_method()::$_0>(parallel_vector::test_method()::$_0&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:96:14 (librarytest_mcrl2_atermpp_parallel_container_test+0x14fee8)
    #5 void std::thread::_Invoker<std::tuple<parallel_vector::test_method()::$_0> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:259:13 (librarytest_mcrl2_atermpp_parallel_container_test+0x14fee8)
    #6 std::thread::_Invoker<std::tuple<parallel_vector::test_method()::$_0> >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:266:11 (librarytest_mcrl2_atermpp_parallel_container_test+0x14fee8)
    #7 std::thread::_State_impl<std::thread::_Invoker<std::tuple<parallel_vector::test_method()::$_0> > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:211:13 (librarytest_mcrl2_atermpp_parallel_container_test+0x14fee8)
    #8 <null> <null> (libstdc++.so.6+0xdc252) (BuildId: e37fe1a879783838de78cbc8c80621fa685d58a2)
  Previous read of size 8 at 0x7fd4f4afd4c8 by main thread (mutexes: write M0):
    #0 atermpp::detail::thread_aterm_pool::mark() /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/include/mcrl2/atermpp/detail/thread_aterm_pool_implementation.h:199:18 (libmcrl2_atermpp.so+0x1c1a0) (BuildId: 2896136c84f89b54710268bb5d0d49bb948bb4df)
    #1 atermpp::detail::aterm_pool::collect_impl(mcrl2::utilities::shared_mutex&) /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/include/mcrl2/atermpp/detail/aterm_pool_implementation.h:223:13 (librarytest_mcrl2_atermpp_parallel_container_test+0x185c1b) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #2 atermpp::detail::aterm_pool::collect(mcrl2::utilities::shared_mutex&) /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/include/mcrl2/atermpp/detail/aterm_pool_implementation.h:97:3 (librarytest_mcrl2_atermpp_parallel_container_test+0x14a7e6) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #3 atermpp::detail::thread_aterm_pool::collect() /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/include/mcrl2/atermpp/detail/thread_aterm_pool.h:123:34 (librarytest_mcrl2_atermpp_parallel_container_test+0x14a7e6)
    #4 parallel_vector::test_method() /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/test/parallel_container_test.cpp:45:45 (librarytest_mcrl2_atermpp_parallel_container_test+0x14a7e6)
    #5 parallel_vector_invoker() /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/test/parallel_container_test.cpp:22:1 (librarytest_mcrl2_atermpp_parallel_container_test+0x14a426) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #6 boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:117:11 (librarytest_mcrl2_atermpp_parallel_container_test+0x19bc3b) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #7 boost::function0<void>::operator()() const /usr/include/boost/function/function_template.hpp:763:14 (librarytest_mcrl2_atermpp_parallel_container_test+0x197188) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #8 boost::detail::forward::operator()() /usr/include/boost/test/impl/execution_monitor.ipp:1388:32 (librarytest_mcrl2_atermpp_parallel_container_test+0x197188)
    #9 boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:137:18 (librarytest_mcrl2_atermpp_parallel_container_test+0x197188)
    #10 boost::function0<int>::operator()() const /usr/include/boost/function/function_template.hpp:763:14 (librarytest_mcrl2_atermpp_parallel_container_test+0x12ba08) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #11 int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()> >(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:301:30 (librarytest_mcrl2_atermpp_parallel_container_test+0x12ba08)
    #12 boost::execution_monitor::catch_signals(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:903:16 (librarytest_mcrl2_atermpp_parallel_container_test+0x12ba08)
    #13 boost::execution_monitor::execute(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1301:16 (librarytest_mcrl2_atermpp_parallel_container_test+0x12bc70) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #14 boost::execution_monitor::vexecute(boost::function<void ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1397:5 (librarytest_mcrl2_atermpp_parallel_container_test+0x127f97) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #15 boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) /usr/include/boost/test/impl/unit_test_monitor.ipp:49:9 (librarytest_mcrl2_atermpp_parallel_container_test+0x127f97)
    #16 boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:815:44 (librarytest_mcrl2_atermpp_parallel_container_test+0x15527f) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #17 boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:740:54 (librarytest_mcrl2_atermpp_parallel_container_test+0x1553d2) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #18 boost::unit_test::framework::run(unsigned long, bool) /usr/include/boost/test/impl/framework.ipp:1721:29 (librarytest_mcrl2_atermpp_parallel_container_test+0x126f04) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #19 boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) /usr/include/boost/test/impl/unit_test_main.ipp:250:9 (librarytest_mcrl2_atermpp_parallel_container_test+0x13f0b2) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #20 main /usr/include/boost/test/impl/unit_test_main.ipp:306:12 (librarytest_mcrl2_atermpp_parallel_container_test+0x13f535) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
  Location is stack of thread T1.
  Mutex M0 (0x7b1400000028) created at:
    #0 pthread_mutex_lock <null> (librarytest_mcrl2_atermpp_parallel_container_test+0xb22ca) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #1 __gthread_mutex_lock(pthread_mutex_t*) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:749:12 (libmcrl2_atermpp.so+0x1c2cc) (BuildId: 2896136c84f89b54710268bb5d0d49bb948bb4df)
    #2 std::mutex::lock() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_mutex.h:100:17 (libmcrl2_atermpp.so+0x1c2cc)
    #3 std::lock_guard<std::mutex>::lock_guard(std::mutex&) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_mutex.h:229:19 (libmcrl2_atermpp.so+0x1c2cc)
    #4 mcrl2::utilities::shared_mutex_data::register_mutex(mcrl2::utilities::shared_mutex*) /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/utilities/include/mcrl2/utilities/shared_mutex.h:99:21 (libmcrl2_atermpp.so+0x1c2cc)
    #5 mcrl2::utilities::shared_mutex::shared_mutex() /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/utilities/include/mcrl2/utilities/shared_mutex.h:122:15 (libmcrl2_atermpp.so+0x42f6e) (BuildId: 2896136c84f89b54710268bb5d0d49bb948bb4df)
    #6 atermpp::detail::aterm_pool::aterm_pool() /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/include/mcrl2/atermpp/detail/aterm_pool_implementation.h:24:13 (libmcrl2_atermpp.so+0x42f6e)
    #7 atermpp::detail::aterm_pool& atermpp::detail::g_term_pool<true>() /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/include/mcrl2/atermpp/detail/global_aterm_pool.h:38:36 (libmcrl2_atermpp.so+0x19aea) (BuildId: 2896136c84f89b54710268bb5d0d49bb948bb4df)
    #8 __cxx_global_var_init.1 /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/source/function_symbol.cpp:15:34 (libmcrl2_atermpp.so+0x19aea)
    #9 _GLOBAL__sub_I_function_symbol.cpp /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/source/function_symbol.cpp (libmcrl2_atermpp.so+0x19aea)
    #10 <null> <null> (ld-linux-x86-64.so.2+0x647d) (BuildId: 9718d3757f00d2366056830aae09698dbd35e32c)
  Thread T1 (tid=1511421, running) created by main thread at:
    #0 pthread_create <null> (librarytest_mcrl2_atermpp_parallel_container_test+0x9473d) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xdc328) (BuildId: e37fe1a879783838de78cbc8c80621fa685d58a2)
    #2 parallel_vector_invoker() /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/test/parallel_container_test.cpp:22:1 (librarytest_mcrl2_atermpp_parallel_container_test+0x14a426) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #3 boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:117:11 (librarytest_mcrl2_atermpp_parallel_container_test+0x19bc3b) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #4 boost::function0<void>::operator()() const /usr/include/boost/function/function_template.hpp:763:14 (librarytest_mcrl2_atermpp_parallel_container_test+0x197188) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #5 boost::detail::forward::operator()() /usr/include/boost/test/impl/execution_monitor.ipp:1388:32 (librarytest_mcrl2_atermpp_parallel_container_test+0x197188)
    #6 boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:137:18 (librarytest_mcrl2_atermpp_parallel_container_test+0x197188)
    #7 boost::function0<int>::operator()() const /usr/include/boost/function/function_template.hpp:763:14 (librarytest_mcrl2_atermpp_parallel_container_test+0x12ba08) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #8 int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()> >(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:301:30 (librarytest_mcrl2_atermpp_parallel_container_test+0x12ba08)
    #9 boost::execution_monitor::catch_signals(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:903:16 (librarytest_mcrl2_atermpp_parallel_container_test+0x12ba08)
    #10 boost::execution_monitor::execute(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1301:16 (librarytest_mcrl2_atermpp_parallel_container_test+0x12bc70) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #11 boost::execution_monitor::vexecute(boost::function<void ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1397:5 (librarytest_mcrl2_atermpp_parallel_container_test+0x127f97) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #12 boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) /usr/include/boost/test/impl/unit_test_monitor.ipp:49:9 (librarytest_mcrl2_atermpp_parallel_container_test+0x127f97)
    #13 boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:815:44 (librarytest_mcrl2_atermpp_parallel_container_test+0x15527f) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #14 boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:740:54 (librarytest_mcrl2_atermpp_parallel_container_test+0x1553d2) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #15 boost::unit_test::framework::run(unsigned long, bool) /usr/include/boost/test/impl/framework.ipp:1721:29 (librarytest_mcrl2_atermpp_parallel_container_test+0x126f04) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #16 boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) /usr/include/boost/test/impl/unit_test_main.ipp:250:9 (librarytest_mcrl2_atermpp_parallel_container_test+0x13f0b2) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
    #17 main /usr/include/boost/test/impl/unit_test_main.ipp:306:12 (librarytest_mcrl2_atermpp_parallel_container_test+0x13f535) (BuildId: 79f0173b56cedb4ac6224702d2f2d9c1218b3cfa)
SUMMARY: ThreadSanitizer: data race on vptr (ctor/dtor vs virtual call) /storage/teamcity/TeamCity/buildAgent1/work/c1149d302b50fc7c/src/libraries/atermpp/include/mcrl2/atermpp/detail/aterm_implementation.h:53:3 in atermpp::detail::_aterm_container::~_aterm_container()
==================
Running 1 test case...
[NON-XML-CHAR-0x1B]*** No errors detected
[NON-XML-CHAR-0x1B]ThreadSanitizer: reported 1 warnings
@mlaveaux mlaveaux added the bug Something isn't working label Oct 12, 2023
@mlaveaux mlaveaux self-assigned this Oct 12, 2023
@mlaveaux mlaveaux changed the title data race on vptr (ctor/dtor vs virtual call) _aterm_container data race on vptr (ctor/dtor vs virtual call) Oct 12, 2023
@mlaveaux
Copy link
Member Author

Avoided inheritance here so this specific issue has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant