Update valgrind suppressions.
To test this PR:
$ valgrind --suppressions=contrib/valgrind.supp src/test/test_bitcoin
$ valgrind --suppressions=contrib/valgrind.supp src/bench/bench_bitcoin -evals=1 \
-scaling=0.0
Update valgrind suppressions.
To test this PR:
$ valgrind --suppressions=contrib/valgrind.supp src/test/test_bitcoin
$ valgrind --suppressions=contrib/valgrind.supp src/bench/bench_bitcoin -evals=1 \
-scaling=0.0
Some notes:
./test, like the other suppressions?I get these errors:
$ valgrind --leak-check=full --show-reachable=yes --error-limit=no --gen-suppressions=all --suppressions=./contrib/valgrind.supp ./src/test/test_bitcoin -t merkle_tests
==32499== Memcheck, a memory error detector
==32499== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==32499== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==32499== Command: ./src/test/test_bitcoin -t merkle_tests
==32499==
Running 6 test cases...
==32499== Conditional jump or move depends on uninitialised value(s)
==32499== at 0x48806CD: boost::filesystem::detail::directory_iterator_increment(boost::filesystem::directory_iterator&, boost::system::error_code*) (in /usr/lib64/libboost_filesystem.so.1.69.0)
==32499== by 0x4880D0A: boost::filesystem::detail::directory_iterator_construct(boost::filesystem::directory_iterator&, boost::filesystem::path const&, boost::system::error_code*) (in /usr/lib64/libboost_filesystem.so.1.69.0)
==32499== by 0x48814D6: ??? (in /usr/lib64/libboost_filesystem.so.1.69.0)
==32499== by 0x488181E: boost::filesystem::detail::remove_all(boost::filesystem::path const&, boost::system::error_code*) (in /usr/lib64/libboost_filesystem.so.1.69.0)
==32499== by 0x27CA1F: remove_all (operations.hpp:673)
==32499== by 0x27CA1F: BasicTestingSetup::~BasicTestingSetup() (setup_common.cpp:93)
==32499== by 0x27EBF1: TestingSetup::~TestingSetup() (setup_common.cpp:138)
==32499== by 0x425CC7: ~merkle_test (merkle_tests.cpp:183)
==32499== by 0x425CC7: merkle_tests::merkle_test_invoker() (merkle_tests.cpp:183)
==32499== by 0x4920581: ??? (in /usr/lib64/libboost_unit_test_framework.so.1.69.0)
==32499== by 0x491F5EC: boost::execution_monitor::catch_signals(boost::function<int ()> const&) (in /usr/lib64/libboost_unit_test_framework.so.1.69.0)
==32499== by 0x491F677: boost::execution_monitor::execute(boost::function<int ()> const&) (in /usr/lib64/libboost_unit_test_framework.so.1.69.0)
==32499== by 0x491F74D: boost::execution_monitor::vexecute(boost::function<void ()> const&) (in /usr/lib64/libboost_unit_test_framework.so.1.69.0)
==32499== by 0x494A24E: boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned int) (in /usr/lib64/libboost_unit_test_framework.so.1.69.0)
==32499==
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:_ZN5boost10filesystem6detail28directory_iterator_incrementERNS0_18directory_iteratorEPNS_6system10error_codeE
fun:_ZN5boost10filesystem6detail28directory_iterator_constructERNS0_18directory_iteratorERKNS0_4pathEPNS_6system10error_codeE
obj:/usr/lib64/libboost_filesystem.so.1.69.0
fun:_ZN5boost10filesystem6detail10remove_allERKNS0_4pathEPNS_6system10error_codeE
fun:remove_all
fun:_ZN17BasicTestingSetupD1Ev
fun:_ZN12TestingSetupD1Ev
fun:~merkle_test
fun:_ZN12merkle_testsL19merkle_test_invokerEv
obj:/usr/lib64/libboost_unit_test_framework.so.1.69.0
fun:_ZN5boost17execution_monitor13catch_signalsERKNS_8functionIFivEEE
fun:_ZN5boost17execution_monitor7executeERKNS_8functionIFivEEE
fun:_ZN5boost17execution_monitor8vexecuteERKNS_8functionIFvvEEE
fun:_ZN5boost9unit_test19unit_test_monitor_t21execute_and_translateERKNS_8functionIFvvEEEj
}
...
Oh, and for a follow-up: The leveldb suppressions should be removed after #17398
52 | + fun:wcsnrtombs 53 | + ... 54 | + fun:_ZN5boost10filesystem6detail11unique_pathERKNS0_4pathEPNS_6system10error_codeE 55 | +} 56 | +{ 57 | + Suppress boost::filesystem warning
Suppress boost::filesystem warning. Fixed in boost 1.70 (https://github.com/boostorg/filesystem/commit/bbe9d1771e5d679b3f10c42a58fc81f7e8c024a9)
72 | + Memcheck:Leak 73 | + match-leak-kinds: reachable 74 | + fun:_Znwm 75 | + fun:_Z11LogInstancev 76 | + ... 77 | + fun:SeedInsecureRand
What is the issue? This should be fixed.
I guess the issue is generally with LogInstance and not SeedInsecureRand?
True! Fixed! :)
6 | @@ -7,6 +7,10 @@ 7 | # $ valgrind --suppressions=contrib/valgrind.supp src/test/test_bitcoin 8 | # $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \ 9 | # --show-leak-kinds=all src/test/test_bitcoin --log_level=test_suite 10 | +# 11 | +# To create suppressions for found issues, use the --gen-suppressions=all option.
Why not
--leak-check=full --show-reachable=yes --error-limit=no --gen-suppressions=all --suppressions=the_current_file
?
59 | + fun:_ZN5boost10filesystem6detail28directory_iterator_incrementERNS0_18directory_iteratorEPNS_6system10error_codeE 60 | + fun:_ZN5boost10filesystem6detail28directory_iterator_constructERNS0_18directory_iteratorERKNS0_4pathEPNS_6system10error_codeE 61 | + obj:*/libboost_filesystem.so.* 62 | +} 63 | +{ 64 | + Suppress boost::filesystem warning
I couldn't find a fix or bug report for this
Me neither.
I created the suppressions on a plain Ubuntu 18.04.2 LTS machine. As non-exotic as it gets :)
This is the full output:
==7373== 51 bytes in 1 blocks are still reachable in loss record 2 of 6
==7373== at 0x4C3017F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7373== by 0x504AAC9: boost::filesystem::absolute(boost::filesystem::path const&, boost::filesystem::path const&) (in /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.65.1)
==7373== by 0x90A6D2: AbsPathForConfigVal(boost::filesystem::path const&, bool) (system.cpp:1126)
==7373== by 0x6B9937: InitLogging() (init.cpp:827)
==7373== by 0x18A712: BasicTestingSetup::BasicTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (setup_common.cpp:74)
==7373== by 0x18A96B: TestingSetup::TestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (setup_common.cpp:97)
==7373== by 0x3218CC: merkle_test_BlockWitness (merkle_tests.cpp:330)
==7373== by 0x3218CC: merkle_tests::merkle_test_BlockWitness_invoker() (merkle_tests.cpp:330)
==7373== by 0x58EF2CD: boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) (in /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.65.1)
==7373== by 0x58EE77C: boost::execution_monitor::catch_signals(boost::function<int ()> const&) (in /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.65.1)
==7373== by 0x58EE860: boost::execution_monitor::execute(boost::function<int ()> const&) (in /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.65.1)
==7373== by 0x58EEFDC: boost::execution_monitor::vexecute(boost::function<void ()> const&) (in /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.65.1)
==7373== by 0x591D8D0: boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned int) (in /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.65.1)
==7373==
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: reachable
fun:_Znwm
fun:_ZN5boost10filesystem8absoluteERKNS0_4pathES3_
fun:_Z19AbsPathForConfigValRKN5boost10filesystem4pathEb
fun:_Z11InitLoggingv
fun:_ZN17BasicTestingSetupC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
fun:_ZN12TestingSetupC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
fun:merkle_test_BlockWitness
fun:_ZN12merkle_testsL32merkle_test_BlockWitness_invokerEv
fun:_ZN5boost6detail8function21function_obj_invoker0INS0_7forwardEiE6invokeERNS1_15function_bufferE
fun:_ZN5boost17execution_monitor13catch_signalsERKNS_8functionIFivEEE
fun:_ZN5boost17execution_monitor7executeERKNS_8functionIFivEEE
fun:_ZN5boost17execution_monitor8vexecuteERKNS_8functionIFvvEEE
fun:_ZN5boost9unit_test19unit_test_monitor_t21execute_and_translateERKNS_8functionIFvvEEEj
}
44 | @@ -41,3 +45,34 @@ 45 | ... 46 | fun:_ZN7leveldbL14InitDefaultEnvEv 47 | } 48 | +{ 49 | + Suppress boost::filesystem warning
Is there a fix or bug report for this?
Not that I've been able to find.
I created the suppressions on a plain Ubuntu 18.04.2 LTS machine. As non-exotic as it gets :)
Full output:
==29772== Invalid read of size 16
==29772== at 0x7712ABD: __wcsnlen_sse4_1 (strlen.S:194)
==29772== by 0x7700458: wcsnrtombs (wcsnrtombs.c:58)
==29772== by 0x6DB2E6D: std::codecvt<wchar_t, char, __mbstate_t>::do_out(__mbstate_t&, wchar_t const*, wchar_t const*, wchar_t const*&, char*, char*, char*&) const (in /usr/lib/x86_64-linux-g
nu/libstdc++.so.6.0.25)
==29772== by 0x50551B1: boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::codecvt<
wchar_t, char, __mbstate_t> const&) (in /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.65.1)
==29772== by 0x505563A: boost::filesystem::detail::unique_path(boost::filesystem::path const&, boost::system::error_code*) (in /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.65.1)
==29772== by 0x904E75: unique_path (operations.hpp:723)
==29772== by 0x904E75: DirIsWritable(boost::filesystem::path const&) (system.cpp:122)
==29772== by 0x4CE8A0: util_tests::test_DirIsWritable::test_method() (util_tests.cpp:1613)
==29772== by 0x4CEF98: util_tests::test_DirIsWritable_invoker() (util_tests.cpp:1601)
==29772== by 0x58EF2CD: boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) (in /usr/lib/x86_64-linux-gnu/libboost_u
nit_test_framework.so.1.65.1)
==29772== by 0x58EE77C: boost::execution_monitor::catch_signals(boost::function<int ()> const&) (in /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.65.1)
==29772== by 0x58EE860: boost::execution_monitor::execute(boost::function<int ()> const&) (in /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.65.1)
==29772== by 0x58EEFDC: boost::execution_monitor::vexecute(boost::function<void ()> const&) (in /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.65.1)
==29772== Address 0x12b82050 is 0 bytes after a block of size 80 alloc'd
==29772== at 0x4C3017F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==29772== by 0x6E3BCAA: std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_mutate(unsigned long, unsigned long, wchar_t const*, unsigned long) (in /u
sr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==29772== by 0x6E3CB02: std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_replace(unsigned long, unsigned long, wchar_t const*, unsigned long) (in /
usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25) ==29772== by 0x5054F11: boost::filesystem::path_traits::convert(char const*, char const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codec
vt<wchar_t, char, __mbstate_t> const&) (in /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.65.1)
==29772== by 0x50556F7: boost::filesystem::detail::unique_path(boost::filesystem::path const&, boost::system::error_code*) (in /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.65.1)
==29772== by 0x904E75: unique_path (operations.hpp:723)
==29772== by 0x904E75: DirIsWritable(boost::filesystem::path const&) (system.cpp:122)
==29772== by 0x4CE8A0: util_tests::test_DirIsWritable::test_method() (util_tests.cpp:1613)
==29772== by 0x4CEF98: util_tests::test_DirIsWritable_invoker() (util_tests.cpp:1601)
==29772== by 0x58EF2CD: boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) (in /usr/lib/x86_64-linux-gnu/libboost_u
nit_test_framework.so.1.65.1)
==29772== by 0x58EE77C: boost::execution_monitor::catch_signals(boost::function<int ()> const&) (in /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.65.1)
==29772== by 0x58EE860: boost::execution_monitor::execute(boost::function<int ()> const&) (in /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.65.1)
==29772== by 0x58EEFDC: boost::execution_monitor::vexecute(boost::function<void ()> const&) (in /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.65.1)
==29772==
{
<insert_a_suppression_name_here>
Memcheck:Addr16
fun:__wcsnlen_sse4_1
fun:wcsnrtombs
fun:_ZNKSt7codecvtIwc11__mbstate_tE6do_outERS0_PKwS4_RS4_PcS6_RS6_
fun:_ZN5boost10filesystem11path_traits7convertEPKwS3_RNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt7codecvtIwc11__mbstate_tE
fun:_ZN5boost10filesystem6detail11unique_pathERKNS0_4pathEPNS_6system10error_codeE
fun:unique_path
fun:_Z13DirIsWritableRKN5boost10filesystem4pathE
fun:_ZN10util_tests18test_DirIsWritable11test_methodEv
fun:_ZN10util_testsL26test_DirIsWritable_invokerEv
fun:_ZN5boost6detail8function21function_obj_invoker0INS0_7forwardEiE6invokeERNS1_15function_bufferE
fun:_ZN5boost17execution_monitor13catch_signalsERKNS_8functionIFivEEE
fun:_ZN5boost17execution_monitor7executeERKNS_8functionIFivEEE
fun:_ZN5boost17execution_monitor8vexecuteERKNS_8functionIFvvEEE
}
Added reference to related issue.
6 | @@ -7,6 +7,14 @@ 7 | # $ valgrind --suppressions=contrib/valgrind.supp src/test/test_bitcoin 8 | # $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \ 9 | # --show-leak-kinds=all src/test/test_bitcoin --log_level=test_suite 10 | +# 11 | +# To create suppressions for found issues, use the --gen-suppressions=all option: 12 | +# $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \ 13 | +# --show-leak-kinds=all --gen-suppressions=all --show-reachable=yes \ 14 | +# --error-limit=no --gen-suppressions=all \ 15 | +# src/test/test_bitcoin --log_level=test_suite
This will be very verbose and makes it hard to spot suppressions
# src/test/test_bitcoin
@MarcoFalke Could you re-run …
$ valgrind --suppressions=contrib/valgrind.supp src/test/test_bitcoin
$ valgrind --suppressions=contrib/valgrind.supp src/bench/bench_bitcoin -evals=1 \
-scaling=0.0
… on your system with the updated suppressions and see if it passes without warnings? :)
- Would be nice to explain how to generate suppressions
Documentation added.
- Does it make sense to move it to
./test, like the other suppressions?
Sure! Do you have any suggestion on where under test/ to put it?
- Does the list depend on OS/library versions?
Documentation added.
I get these errors:
Suppressions added.