-
Notifications
You must be signed in to change notification settings - Fork 96
make sanitizer happy #205
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
Merged
gbiggs
merged 5 commits into
ros:rolling
from
iuhilnehc-ynos:topic_fix_MultiLibraryClassLoader
Jan 16, 2023
Merged
make sanitizer happy #205
gbiggs
merged 5 commits into
ros:rolling
from
iuhilnehc-ynos:topic_fix_MultiLibraryClassLoader
Jan 16, 2023
+70
−12
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Author
|
sanitizer seems happy, https://github.com/iuhilnehc-ynos/class_loader/actions/runs/3311503280/jobs/5467034199 |
Author
9df9064 to
f308370
Compare
Author
144c479 to
61423ab
Compare
Author
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
…ss_loaders_` Signed-off-by: Chen Lihui <lihui.chen@sony.com>
… times allow ClassLoader to unloadlibrary multiple times without throwing exception Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
61423ab to
1d09914
Compare
|
@iuhilnehc-ynos is this ready to review? |
gbiggs
approved these changes
Dec 21, 2022
fujitatomoya
approved these changes
Jan 15, 2023
fujitatomoya
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
@gbiggs can you merge this, we do not have permission on this repo. |
|
Sure! Thanks for checking. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
related to #201 (comment)
The CI logs will be expired in the future and might no longer be available, so I copy the log as follows,
MultiLibraryClassLoader memory leak
==6769==ERROR: LeakSanitizer: detected memory leaks Direct leak of 144 byte(s) in 1 object(s) allocated from: #0 0x7efc617811c7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99 #1 0x7efc616bac16 in class_loader::MultiLibraryClassLoader::loadLibrary(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /root/target_ws/src/class_loader/src/multi_library_class_loader.cpp:96 #2 0x56419df31a12 in MultiClassLoaderTest_noWarningOnLazyLoad_Test::TestBody() /root/target_ws/src/class_loader/test/utest.cpp:380 #3 0x56419df88576 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2433 #4 0x56419df8129e in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2469 #5 0x56419df5b755 in testing::Test::Run() /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2508 #6 0x56419df5c19a in testing::TestInfo::Run() /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2684 #7 0x56419df5c8fb in testing::TestSuite::Run() /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2816 #8 0x56419df68f10 in testing::internal::UnitTestImpl::RunAllTests() /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:5338 #9 0x56419df89a68 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2433 #10 0x56419df824b2 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2469 #11 0x56419df676f2 in testing::UnitTest::Run() /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:4925 #12 0x56419df3871f in RUN_ALL_TESTS() (/root/target_ws/build/class_loader/test/class_loader_utest+0x3271f) #13 0x56419df33fe6 in main /root/target_ws/src/class_loader/test/utest.cpp:448 #14 0x7efc6110fd8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) Direct leak of 144 byte(s) in 1 object(s) allocated from: #0 0x7efc617811c7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99 #1 0x7efc616bac16 in class_loader::MultiLibraryClassLoader::loadLibrary(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /root/target_ws/src/class_loader/src/multi_library_class_loader.cpp:96 #2 0x56419df31a2b in MultiClassLoaderTest_noWarningOnLazyLoad_Test::TestBody() /root/target_ws/src/class_loader/test/utest.cpp:381 #3 0x56419df88576 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2433 #4 0x56419df8129e in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2469 #5 0x56419df5b755 in testing::Test::Run() /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2508 #6 0x56419df5c19a in testing::TestInfo::Run() /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2684 #7 0x56419df5c8fb in testing::TestSuite::Run() /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2816 #8 0x56419df68f10 in testing::internal::UnitTestImpl::RunAllTests() /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:5338 #9 0x56419df89a68 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2433 #10 0x56419df824b2 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2469 #11 0x56419df676f2 in testing::UnitTest::Run() /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:4925 #12 0x56419df3871f in RUN_ALL_TESTS() (/root/target_ws/build/class_loader/test/class_loader_utest+0x3271f) #13 0x56419df33fe6 in main /root/target_ws/src/class_loader/test/utest.cpp:448 #14 0x7efc6110fd8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) Indirect leak of 64 byte(s) in 2 object(s) allocated from: #0 0x7efc617811c7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99 #1 0x7efc61563ad9 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) (/lib/x86_64-linux-gnu/libstdc++.so.6+0x14ead9) SUMMARY: AddressSanitizer: 352 byte(s) leaked in 4 allocation(s).potential dead lock
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=7271) Cycle in lock order graph: M98 (0x7b24000001e8) => M99 (0x7b2400000218) => M98 Mutex M99 acquired here while holding mutex M98 in main thread: #0 pthread_mutex_lock ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4240 (libtsan.so.0+0x53908) #1 __gthread_mutex_lock(pthread_mutex_t*) <null> (class_loader_unique_ptr_test+0x1d1ff) #2 __gthread_recursive_mutex_lock(pthread_mutex_t*) <null> (class_loader_unique_ptr_test+0x1d283) #3 std::recursive_mutex::lock() <null> (class_loader_unique_ptr_test+0x1d852) #4 class_loader::ClassLoader::unloadLibraryInternal(bool) /root/target_ws/src/class_loader/src/class_loader.cpp:122 (libclass_loader.so+0x37513) #5 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2433 (class_loader_unique_ptr_test+0x64238) #6 main /root/target_ws/src/class_loader/test/unique_ptr_test.cpp:295 (class_loader_unique_ptr_test+0x1baf8) Hint: use TSAN_OPTIONS=second_deadlock_stack=1 to get more informative warning message Mutex M98 acquired here while holding mutex M99 in main thread: #0 pthread_mutex_lock ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4240 (libtsan.so.0+0x53908) #1 __gthread_mutex_lock(pthread_mutex_t*) <null> (class_loader_unique_ptr_test+0x1d1ff) #2 __gthread_recursive_mutex_lock(pthread_mutex_t*) <null> (class_loader_unique_ptr_test+0x1d283) #3 std::recursive_mutex::lock() <null> (class_loader_unique_ptr_test+0x1d852) #4 std::lock_guard<std::recursive_mutex>::lock_guard(std::recursive_mutex&) <null> (class_loader_unique_ptr_test+0x22be4) #5 class_loader::ClassLoader::unloadLibraryInternal(bool) /root/target_ws/src/class_loader/src/class_loader.cpp:120 (libclass_loader.so+0x374fd) #6 void std::__invoke_impl<void, void (class_loader::ClassLoader::*&)(Base*), class_loader::ClassLoader*&, Base*>(std::__invoke_memfun_deref, void (class_loader::ClassLoader::*&)(Base*), class_loader::ClassLoader*&, Base*&&) <null> (class_loader_unique_ptr_test+0x2b939) #7 std::__invoke_result<void (class_loader::ClassLoader::*&)(Base*), class_loader::ClassLoader*&, Base*>::type std::__invoke<void (class_loader::ClassLoader::*&)(Base*), class_loader::ClassLoader*&, Base*>(void (class_loader::ClassLoader::*&)(Base*), class_loader::ClassLoader*&, Base*&&) <null> (class_loader_unique_ptr_test+0x2ad29) #8 void std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>::__call<void, Base*&&, 0ul, 1ul>(std::tuple<Base*&&>&&, std::_Index_tuple<0ul, 1ul>) <null> (class_loader_unique_ptr_test+0x29efd) #9 void std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>::operator()<Base*, void>(Base*&&) <null> (class_loader_unique_ptr_test+0x286fe) #10 void std::__invoke_impl<void, std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>&, Base*>(std::__invoke_other, std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>&, Base*&&) <null> (class_loader_unique_ptr_test+0x26557) #11 std::enable_if<std::__and_<std::is_void<void>, std::__is_invocable<std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>&, Base*> >::value, void>::type std::__invoke_r<void, std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>&, Base*>(std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>&, Base*&&) <null> (class_loader_unique_ptr_test+0x24783) #12 std::_Function_handler<void (Base*), std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)> >::_M_invoke(std::_Any_data const&, Base*&&) <null> (class_loader_unique_ptr_test+0x22def) #13 std::function<void (Base*)>::operator()(Base*) const <null> (class_loader_unique_ptr_test+0x2118c) #14 std::unique_ptr<Base, std::function<void (Base*)> >::~unique_ptr() <null> (class_loader_unique_ptr_test+0x1efe8) #15 MultiClassLoaderUniquePtrTest_noWarningOnLazyLoad_Test::TestBody() /root/target_ws/src/class_loader/test/unique_ptr_test.cpp:284 (class_loader_unique_ptr_test+0x1b76e) #16 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2433 (class_loader_unique_ptr_test+0x64238) #17 main /root/target_ws/src/class_loader/test/unique_ptr_test.cpp:295 (class_loader_unique_ptr_test+0x1baf8) SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) (/root/target_ws/build/class_loader/test/class_loader_unique_ptr_test+0x1d1ff) in __gthread_mutex_lock(pthread_mutex_t*) ================== ================== WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=7271) Cycle in lock order graph: M96 (0x7b24000000c8) => M97 (0x7b24000000f8) => M96 Mutex M97 acquired here while holding mutex M96 in main thread: #0 pthread_mutex_lock ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4240 (libtsan.so.0+0x53908) #1 __gthread_mutex_lock(pthread_mutex_t*) <null> (class_loader_unique_ptr_test+0x1d1ff) #2 __gthread_recursive_mutex_lock(pthread_mutex_t*) <null> (class_loader_unique_ptr_test+0x1d283) #3 std::recursive_mutex::lock() <null> (class_loader_unique_ptr_test+0x1d852) #4 class_loader::ClassLoader::unloadLibraryInternal(bool) /root/target_ws/src/class_loader/src/class_loader.cpp:122 (libclass_loader.so+0x37513) #5 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2433 (class_loader_unique_ptr_test+0x64238) #6 main /root/target_ws/src/class_loader/test/unique_ptr_test.cpp:295 (class_loader_unique_ptr_test+0x1baf8) Hint: use TSAN_OPTIONS=second_deadlock_stack=1 to get more informative warning message Mutex M96 acquired here while holding mutex M97 in main thread: #0 pthread_mutex_lock ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4240 (libtsan.so.0+0x53908) #1 __gthread_mutex_lock(pthread_mutex_t*) <null> (class_loader_unique_ptr_test+0x1d1ff) #2 __gthread_recursive_mutex_lock(pthread_mutex_t*) <null> (class_loader_unique_ptr_test+0x1d283) #3 std::recursive_mutex::lock() <null> (class_loader_unique_ptr_test+0x1d852) #4 std::lock_guard<std::recursive_mutex>::lock_guard(std::recursive_mutex&) <null> (class_loader_unique_ptr_test+0x22be4) #5 class_loader::ClassLoader::unloadLibraryInternal(bool) /root/target_ws/src/class_loader/src/class_loader.cpp:120 (libclass_loader.so+0x374fd) #6 void std::__invoke_impl<void, void (class_loader::ClassLoader::*&)(Base*), class_loader::ClassLoader*&, Base*>(std::__invoke_memfun_deref, void (class_loader::ClassLoader::*&)(Base*), class_loader::ClassLoader*&, Base*&&) <null> (class_loader_unique_ptr_test+0x2b939) #7 std::__invoke_result<void (class_loader::ClassLoader::*&)(Base*), class_loader::ClassLoader*&, Base*>::type std::__invoke<void (class_loader::ClassLoader::*&)(Base*), class_loader::ClassLoader*&, Base*>(void (class_loader::ClassLoader::*&)(Base*), class_loader::ClassLoader*&, Base*&&) <null> (class_loader_unique_ptr_test+0x2ad29) #8 void std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>::__call<void, Base*&&, 0ul, 1ul>(std::tuple<Base*&&>&&, std::_Index_tuple<0ul, 1ul>) <null> (class_loader_unique_ptr_test+0x29efd) #9 void std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>::operator()<Base*, void>(Base*&&) <null> (class_loader_unique_ptr_test+0x286fe) #10 void std::__invoke_impl<void, std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>&, Base*>(std::__invoke_other, std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>&, Base*&&) <null> (class_loader_unique_ptr_test+0x26557) #11 std::enable_if<std::__and_<std::is_void<void>, std::__is_invocable<std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>&, Base*> >::value, void>::type std::__invoke_r<void, std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>&, Base*>(std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)>&, Base*&&) <null> (class_loader_unique_ptr_test+0x24783) #12 std::_Function_handler<void (Base*), std::_Bind<void (class_loader::ClassLoader::*(class_loader::ClassLoader*, std::_Placeholder<1>))(Base*)> >::_M_invoke(std::_Any_data const&, Base*&&) <null> (class_loader_unique_ptr_test+0x22def) #13 std::function<void (Base*)>::operator()(Base*) const <null> (class_loader_unique_ptr_test+0x2118c) #14 std::unique_ptr<Base, std::function<void (Base*)> >::~unique_ptr() <null> (class_loader_unique_ptr_test+0x1efe8) #15 MultiClassLoaderUniquePtrTest_noWarningOnLazyLoad_Test::TestBody() /root/target_ws/src/class_loader/test/unique_ptr_test.cpp:284 (class_loader_unique_ptr_test+0x1b78c) #16 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /opt/ros/rolling/src/gtest_vendor/./src/gtest.cc:2433 (class_loader_unique_ptr_test+0x64238) #17 main /root/target_ws/src/class_loader/test/unique_ptr_test.cpp:295 (class_loader_unique_ptr_test+0x1baf8) SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock)Signed-off-by: Chen Lihui lihui.chen@sony.com