Prevent UB in DeleteLock() function #18881

pull hebasto wants to merge 6 commits into bitcoin:master from hebasto:200505-cofu changing 2 files +75 βˆ’50
  1. hebasto commented at 6:05 am on May 5, 2020: member

    Tracking our instrumented mutexes (Mutex and RecursiveMutex types) requires that all involved objects should not be destroyed until after their last use. On master (ec79b5f86b22ad8f77c736f9bb76c2e4d7faeaa4) we have two problems related to the object destroying order:

    • the function-local static lockdata object that is destroyed at program exit
    • the thread_local g_lockstack that is destroyed at thread exit

    Both cases could cause UB at program exit in so far as mutexes are used in other static object destructors.

    Fix #18824

  2. hebasto commented at 6:06 am on May 5, 2020: member
    cc @sipa
  3. DrahtBot added the label Docs on May 5, 2020
  4. in src/sync.cpp:87 in 5a406f7603 outdated
    92 };
    93 LockData& GetLockData() {
    94-    static LockData lockdata;
    95-    return lockdata;
    96+    // See doc/developers-notes.md#construct-on-first-use-idiom
    97+    static auto lockdata = new LockData();
    


    MarcoFalke commented at 10:35 am on May 5, 2020:
    0    static LockData* lockdata = new LockData();
    

    not sure why auto needs to hide both the type and the pointer-ness. The additional 5 chars don’t seem overly verbose.


    hebasto commented at 10:53 am on May 5, 2020:
  5. MarcoFalke approved
  6. MarcoFalke commented at 10:35 am on May 5, 2020: member
    ACK
  7. MarcoFalke removed the label Docs on May 5, 2020
  8. hebasto force-pushed on May 5, 2020
  9. hebasto commented at 10:52 am on May 5, 2020: member

    Updated 5a406f76030263c1c4e5335cea3be022263426f2 -> 7e3f40dd594d81b37458f9f5d36d4d7df99f8917 (pr18881.01 -> pr18881.02, diff):

    not sure why auto needs to hide both the type and the pointer-ness. The additional 5 chars don’t seem overly verbose.

  10. in doc/developer-notes.md:864 in 7e3f40dd59 outdated
    859+    static BCLog::Logger* g_logger{new BCLog::Logger()};
    860+    return *g_logger;
    861+}
    862+```
    863+
    864+*Rationale*: This approache guaranties that:
    


    jonatack commented at 11:43 am on May 5, 2020:
    approach guarantees

    hebasto commented at 11:49 am on May 5, 2020:
    Thank you! Updated.

    jonatack commented at 11:58 am on May 5, 2020:
    oops, somehow that comment was published before the review…GitHub :man_shrugging:
  11. in doc/developer-notes.md:847 in 7e3f40dd59 outdated
    839@@ -839,6 +840,37 @@ namespace {
    840 #endif // BITCOIN_FOO_BAR_H
    841 ```
    842 
    843+Construct On First Use idiom
    844+------------------------------
    845+
    846+It is not possible to control the order in which non-local static objects in *different* translation units are initialized.
    847+This is the so-called "`static` initialization order problem". It could cause the use of an object:
    


    jonatack commented at 11:44 am on May 5, 2020:
    I think the markdown is more readable without wrapping “static” in code markup (same for line 853 below)
  12. in doc/developer-notes.md:843 in 7e3f40dd59 outdated
    839@@ -839,6 +840,37 @@ namespace {
    840 #endif // BITCOIN_FOO_BAR_H
    841 ```
    842 
    843+Construct On First Use idiom
    


    jonatack commented at 11:45 am on May 5, 2020:

    can drop “idiom”? or maybe more clear with quotes: “Construct On First Use” idiom, but I personally prefer without “idiom”

    (same for line 853 below)

  13. in doc/developer-notes.md:866 in 7e3f40dd59 outdated
    861+}
    862+```
    863+
    864+*Rationale*: This approache guaranties that:
    865+
    866+- an object gets constructed prior to its first use
    


    jonatack commented at 11:46 am on May 5, 2020:
    s/gets/is/
  14. in doc/developer-notes.md:867 in 7e3f40dd59 outdated
    862+```
    863+
    864+*Rationale*: This approache guaranties that:
    865+
    866+- an object gets constructed prior to its first use
    867+- an object doesn’t get destructed until after its last use
    


    jonatack commented at 11:47 am on May 5, 2020:
    s/doesn’t get/is not/
  15. hebasto force-pushed on May 5, 2020
  16. hebasto commented at 11:49 am on May 5, 2020: member

    Updated 7e3f40dd594d81b37458f9f5d36d4d7df99f8917 -> a2234071ddc633cf92ba501126b74bf78731f676 (pr18881.02 -> pr18881.03, diff):

    approach guarantees

  17. in src/logging.cpp:16 in a2234071dd outdated
    26- * have a trivial destructor.
    27- *
    28- * This method of initialization was originally introduced in
    29- * ee3374234c60aba2cc4c5cd5cac1c0aefc2d817c.
    30- */
    31+    // See doc/developers-notes.md#construct-on-first-use-idiom
    


    jonatack commented at 11:50 am on May 5, 2020:
    developer
  18. in src/random.cpp:439 in a2234071dd outdated
    435@@ -436,8 +436,7 @@ class RNGState {
    436 
    437 RNGState& GetRNGState() noexcept
    438 {
    439-    // This C++11 idiom relies on the guarantee that static variable are initialized
    440-    // on first call, even when multiple parallel calls are permitted.
    441+    // See doc/developers-notes.md#construct-on-first-use-idiom
    


    jonatack commented at 11:51 am on May 5, 2020:
    developer
  19. in doc/developer-notes.md:872 in a2234071dd outdated
    867+- an object doesn’t get destructed until after its last use
    868+- the initialization of an object is thread-safe
    869+
    870+*Note 1*: Even though the object pointed to by a pointer is never deleted, the memory doesn't actually "leak" since the operating system automatically reclaims all the memory in a program's heap when that program exits.
    871+
    872+*Note 2*: If it is required that the destructor for an object is called while the program is exiting, other approaches must be used.
    


    jonatack commented at 11:52 am on May 5, 2020:
    If the destructor for an object needs to be called
  20. in src/sync.cpp:86 in a2234071dd outdated
    91     std::mutex dd_mutex;
    92 };
    93 LockData& GetLockData() {
    94-    static LockData lockdata;
    95-    return lockdata;
    96+    // See doc/developers-notes.md#construct-on-first-use-idiom
    


    jonatack commented at 11:52 am on May 5, 2020:
    developer
  21. jonatack commented at 11:52 am on May 5, 2020: member
    Concept ACK/ACK
  22. hebasto force-pushed on May 5, 2020
  23. hebasto commented at 12:14 pm on May 5, 2020: member

    Updated a2234071ddc633cf92ba501126b74bf78731f676 -> d3c26862e263fea7d49df7f9bc9acef30a84c1ca (pr18881.03 -> pr18881.04, diff):

  24. DrahtBot added the label Docs on May 5, 2020
  25. in doc/developer-notes.md:864 in d3c26862e2 outdated
    859+    static BCLog::Logger* g_logger{new BCLog::Logger()};
    860+    return *g_logger;
    861+}
    862+```
    863+
    864+*Rationale*: This approache guarantees that:
    


    jonatack commented at 12:50 pm on May 5, 2020:
    approach

    hebasto commented at 1:26 pm on May 5, 2020:
  26. in doc/developer-notes.md:853 in d3c26862e2 outdated
    848+- before it is constructed (on program startup)
    849+- after it is destructed (at program exit)
    850+
    851+Both cases lead to undefined behavior.
    852+
    853+To prevent the static initialization order problem, use the Construct On First Use:
    


    jonatack commented at 12:50 pm on May 5, 2020:
    s/use the/be sure to/

    hebasto commented at 1:27 pm on May 5, 2020:
  27. in doc/developer-notes.md:858 in d3c26862e2 outdated
    853+To prevent the static initialization order problem, use the Construct On First Use:
    854+
    855+```C++
    856+BCLog::Logger& LogInstance()
    857+{
    858+    // See doc/developer-notes.md#construct-on-first-use
    


    jonatack commented at 12:53 pm on May 5, 2020:
    comment seems unneeded?

    hebasto commented at 1:17 pm on May 5, 2020:
    It seems developers need multi-line comments to describe rationale of using COFU :) This oneliner is just a pointer to docs with detailed explanation and pitfalls (like not calling a destructor). I’d prefer keep it as is.

    jonatack commented at 1:29 pm on May 5, 2020:
    Yes, in the codebase it’s fine but here it’s a pointer to itself :) edit: reading the rendered doc I guess it’s fine

    hebasto commented at 1:33 pm on May 5, 2020:
    As it is an “example”, the presence of the comment line seems reasonable, no?
  28. in doc/developer-notes.md:856 in d3c26862e2 outdated
    851+Both cases lead to undefined behavior.
    852+
    853+To prevent the static initialization order problem, use the Construct On First Use:
    854+
    855+```C++
    856+BCLog::Logger& LogInstance()
    


    jonatack commented at 12:53 pm on May 5, 2020:
    is this code snippet a good explanation of the concept?

    hebasto commented at 1:19 pm on May 5, 2020:
    Why not? I’d say “example” rather “explanation”.

    jonatack commented at 1:33 pm on May 5, 2020:
    Sure; people can look it up anyway for more info.
  29. in doc/developer-notes.md:866 in d3c26862e2 outdated
    861+}
    862+```
    863+
    864+*Rationale*: This approache guarantees that:
    865+
    866+- an object is constructed prior to its first use
    


    jonatack commented at 12:56 pm on May 5, 2020:

    sorry to re-review the same area, but I think this could be reduced to two points and would be better written as:

    • the object is constructed before first use and not destroyed until after last use
    • the object initialization is thread-safe

    (also: destructed -> destroyed and the “its” can be removed)


    hebasto commented at 1:27 pm on May 5, 2020:

    hebasto commented at 1:30 pm on May 5, 2020:
    “its” seems prevent any ambiguation :)
  30. jonatack commented at 12:58 pm on May 5, 2020: member
    Iterative re-review (apologies)
  31. hebasto force-pushed on May 5, 2020
  32. hebasto commented at 1:26 pm on May 5, 2020: member

    Updated d3c26862e263fea7d49df7f9bc9acef30a84c1ca -> 86ce03c53e22f0ce2c4bfbabd4aae5cf62dcb0fc (pr18881.04 -> pr18881.05, diff):

  33. jonatack commented at 1:31 pm on May 5, 2020: member
    ACK
  34. in doc/developer-notes.md:859 in 86ce03c53e outdated
    854+
    855+```C++
    856+BCLog::Logger& LogInstance()
    857+{
    858+    // See doc/developer-notes.md#construct-on-first-use
    859+    static BCLog::Logger* g_logger{new BCLog::Logger()};
    


    sipa commented at 4:29 pm on May 5, 2020:
    It’s nicer to use std::unique_pointer here, so that the object also gets destroyed on shutdown (in reserve order compared to initialization).

    MarcoFalke commented at 4:36 pm on May 5, 2020:
    Agree that the docs should recommend the version that doesn’t leak. An additional note can say that a version that leaks might be preferable in rare circumstances.

    hebasto commented at 11:45 pm on May 5, 2020:

    IMO, destroying an object via std::unique_pointer:

    • is not required as no actual memory leak happens at program exit (C++ FAQ-a and FAQ-b); in another words, not destroying an object does not implies memory leaks in that case
    • is not safe as this object could (potentially) be destroyed before its last use at program exit sequence, e.g., instances of BCLog::Logger and LockData classes.

    hebasto commented at 11:57 pm on May 5, 2020:
    The initial intention of changing the docs was to drop every long explanation in the source, and just re-direct a code reader to the docs. If these changes seem controversial, all doc-change commits could be dropped :)

    promag commented at 0:59 am on May 6, 2020:

    πŸ‘€

    0static BCLog::Logger logger;
    1return logger;
    

    hebasto commented at 1:46 am on May 6, 2020:
    0static BCLog::Logger logger;
    1return logger;
    

    The logger object could (potentially) be destroyed before its last use at program exit sequence that leads to undefined behavior.


    hebasto commented at 1:48 am on May 6, 2020:
    Actually, the d954f7c8c017c7e9bf60f48a8c41da8c498239f7 commit in this PR fixes such issue for the lockdata object.

    MarcoFalke commented at 6:21 pm on May 6, 2020:
    • Some tools check for leaked memory at exit, so making that the default increases verbosity for those tools.
    • The destructor must be trivial to be able to do that in the first place. I am not sure why you remove that requirement in the docs.

    sipa commented at 6:26 pm on May 6, 2020:

    Not doing that is not a leak. It’s just memory that’s still reachable at exit (which at least valgrind classifies differently than leaked memory, and doesn’t warn about).

    I think it’s just cleaner to clean things up too; for example this makes it easier to move globals into a class if that ever makes sense. Also, if that works, it means there exists a clear layering between which modules depend on which others in terms of initialization order, which is a low-priority nice-to-have if possible.


    laanwj commented at 12:54 pm on May 7, 2020:
    Right, unique_ptr won’t work here. It was the same destruction order (thougn not initialization order) problem as using a global directly.

    hebasto commented at 2:43 pm on May 7, 2020:
    Changes to the developer-notes.md dropped.

    hebasto commented at 2:44 pm on May 7, 2020:
    Changes to the developer-notes.md dropped.
  35. in doc/developer-notes.md:853 in 86ce03c53e outdated
    848+- before it is constructed (on program startup)
    849+- after it is destructed (at program exit)
    850+
    851+Both cases lead to undefined behavior.
    852+
    853+To prevent the static initialization order problem, be sure to Construct On First Use:
    


    laanwj commented at 12:52 pm on May 7, 2020:

    I don’t think you should make this suggestion in general. This solution, while valuable in rare cases such as logging and tracking locks, is a brute-force one that does not belong in actual application code. It’s messy and assumes we don’t actually know what’s going on (in regard to initialization dependencies) or what are all the edge cases.

    You’re supposed to expliclty allocate things in a deterministic order during initialization and destroy it in a (usually reversed) deterministic order on shutdown in the appropriate functions in init.cpp, not rely on global initialization order nor first use.

  36. laanwj commented at 12:53 pm on May 7, 2020: member
    ACK on using this solution in this specific place but NACK on suggesting its use in general.
  37. jonatack commented at 2:23 pm on May 7, 2020: member

    I didn’t find a direct reference to a “COFU” or “Construct on First Use” idiom in any of these books. The best references online seemed to be:

    and I agree with not suggesting it in general.

  38. hebasto force-pushed on May 7, 2020
  39. hebasto commented at 2:40 pm on May 7, 2020: member

    Updated 86ce03c53e22f0ce2c4bfbabd4aae5cf62dcb0fc -> 6bc686839a7cc09e3586e2a47ae4f16b5d918d3a (pr18881.05 -> pr18881.06, diff):

    • only the fix of UB in the DeleteLock() function remains
  40. MarcoFalke commented at 2:41 pm on May 7, 2020: member
    ACK 6bc686839a7cc09e3586e2a47ae4f16b5d918d3a
  41. jonatack commented at 3:16 pm on May 7, 2020: member
    Light code review ACK 6bc6868, this commit appears to be an implementation of the solution in https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use-members
  42. hebasto commented at 3:19 pm on May 7, 2020: member

    Light code review ACK 6bc6868, this commit appears to be an implementation of the solution in https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use-members

    To be exact: https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use

  43. jonatack commented at 3:23 pm on May 7, 2020: member
  44. MarcoFalke removed the label Docs on May 12, 2020
  45. MarcoFalke added the label Refactoring on May 12, 2020
  46. in src/sync.cpp:92 in 6bc686839a outdated
     97+    // The operating system automatically reclaims all the memory in a program's heap when that program exits.
     98+    static LockData* lockdata{new LockData()};
     99+    return *lockdata;
    100 }
    101 
    102 static thread_local LockStack g_lockstack;
    


    MarcoFalke commented at 3:04 pm on May 12, 2020:
    Why is the above UB, but this not?

    hebasto commented at 5:52 am on May 13, 2020:

    The g_lockstack variable is involved in locking and unlocking AnnotatedMixin<> mutexes.

    But lockdata is used in AnnotatedMixin<> destructor: https://github.com/bitcoin/bitcoin/blob/8da1e43b63cb36759eeb1fcfd6768163265c44e2/src/sync.h#L84-L86

    and we have global AnnotatedMixin<> mutexes.


    MarcoFalke commented at 10:45 am on May 13, 2020:
    So it would make sense to fix both occurrences of UB in one pull

    hebasto commented at 11:37 am on May 13, 2020:

    Sorry for my poor English… I meant that only lockdata could be a source of UB because it is used in the ~AnnotatedMixin<> and the destroy order itself is not predictable in any way.

    The destroying of g_lockstack couldn’t cause UB, IMO.


    MarcoFalke commented at 11:51 am on May 13, 2020:

    Ok, I have deleted my comment. Here is the backtrace (same backtrace on master and this pull):

      0valgrind /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn -runs=1 /bitcoin-core/ci/scratch/qa-assets/fuzz_seed_corpus/process_message_blocktxn
      1==51564== Memcheck, a memory error detector
      2==51564== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
      3==51564== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
      4==51564== Command: /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn -runs=1 /bitcoin-core/ci/scratch/qa-assets/fuzz_seed_corpus/process_message_blocktxn
      5==51564== 
      6INFO: Seed: 2408119127
      7INFO: Loaded 1 modules   (115207 inline 8-bit counters): 115207 [0x1357748, 0x137394f), 
      8INFO: Loaded 1 PC tables (115207 PCs): 115207 [0x1373950,0x15359c0), 
      9INFO:      304 files found in /bitcoin-core/ci/scratch/qa-assets/fuzz_seed_corpus/process_message_blocktxn
     10INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 1007323 bytes
     11INFO: seed corpus: files: 304 min: 1b max: 1007323b total: 7665972b rss: 245Mb
     12[#64](/bitcoin-bitcoin/64/)	pulse  cov: 3446 ft: 4828 corp: 45/2817b exec/s: 32 rss: 271Mb
     13[#128](/bitcoin-bitcoin/128/)	pulse  cov: 3507 ft: 6576 corp: 103/13967b exec/s: 42 rss: 277Mb
     14[#256](/bitcoin-bitcoin/256/)	pulse  cov: 3511 ft: 8158 corp: 211/121Kb exec/s: 32 rss: 277Mb
     15[#305](/bitcoin-bitcoin/305/)	INITED cov: 3511 ft: 8241 corp: 229/480Kb exec/s: 30 rss: 280Mb
     16[#305](/bitcoin-bitcoin/305/)	DONE   cov: 3511 ft: 8241 corp: 229/480Kb lim: 301441 exec/s: 30 rss: 280Mb
     17Done 305 runs in 10 second(s)
     18==51564== Invalid write of size 8
     19==51564==    at 0xA5D451: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
     20==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
     21==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
     22==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
     23==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
     24==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
     25==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
     26==51564==    by 0x5559B8: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) (sync.h:126)
     27==51564==    by 0x4DF455: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::UniqueLock(AnnotatedMixin<std::mutex>&, char const*, char const*, int, bool) (sync.h:152)
     28==51564==    by 0xA18954: CScheduler::stop(bool) (scheduler.cpp:77)
     29==51564==    by 0xB05A9D: TestingSetup::~TestingSetup() (setup_common.cpp:174)
     30==51564==    by 0x4CC5A26: __run_exit_handlers (exit.c:108)
     31==51564==  Address 0x5170be0 is 0 bytes inside a block of size 768 free'd
     32==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
     33==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
     34==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
     35==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
     36==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
     37==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
     38==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
     39==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
     40==51564==    by 0x4CC5BDF: exit (exit.c:139)
     41==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
     42==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
     43==51564==  Block was alloc'd at
     44==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
     45==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
     46==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
     47==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
     48==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
     49==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
     50==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
     51==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
     52==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
     53==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
     54==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
     55==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
     56==51564== 
     57==51564== Invalid write of size 1
     58==51564==    at 0xA5D505: CLockLocation::CLockLocation(CLockLocation&&) (sync.cpp:43)
     59==51564==    by 0xA5D467: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
     60==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
     61==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
     62==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
     63==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
     64==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
     65==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
     66==51564==    by 0x5559B8: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) (sync.h:126)
     67==51564==    by 0x4DF455: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::UniqueLock(AnnotatedMixin<std::mutex>&, char const*, char const*, int, bool) (sync.h:152)
     68==51564==    by 0xA18954: CScheduler::stop(bool) (scheduler.cpp:77)
     69==51564==    by 0xB05A9D: TestingSetup::~TestingSetup() (setup_common.cpp:174)
     70==51564==  Address 0x5170be8 is 8 bytes inside a block of size 768 free'd
     71==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
     72==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
     73==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
     74==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
     75==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
     76==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
     77==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
     78==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
     79==51564==    by 0x4CC5BDF: exit (exit.c:139)
     80==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
     81==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
     82==51564==  Block was alloc'd at
     83==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
     84==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
     85==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
     86==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
     87==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
     88==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
     89==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
     90==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
     91==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
     92==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
     93==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
     94==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
     95==51564== 
     96==51564== Invalid write of size 8
     97==51564==    at 0x4991D88: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
     98==51564==    by 0xA5D525: CLockLocation::CLockLocation(CLockLocation&&) (sync.cpp:43)
     99==51564==    by 0xA5D467: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
    100==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
    101==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
    102==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
    103==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    104==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    105==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    106==51564==    by 0x5559B8: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    107==51564==    by 0x4DF455: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::UniqueLock(AnnotatedMixin<std::mutex>&, char const*, char const*, int, bool) (sync.h:152)
    108==51564==    by 0xA18954: CScheduler::stop(bool) (scheduler.cpp:77)
    109==51564==  Address 0x5170bf0 is 16 bytes inside a block of size 768 free'd
    110==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    111==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    112==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    113==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    114==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    115==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    116==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    117==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    118==51564==    by 0x4CC5BDF: exit (exit.c:139)
    119==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    120==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    121==51564==  Block was alloc'd at
    122==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    123==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    124==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    125==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    126==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    127==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    128==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    129==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    130==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    131==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    132==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    133==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    134==51564== 
    135==51564== Invalid write of size 8
    136==51564==    at 0x4991DC5: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
    137==51564==    by 0xA5D525: CLockLocation::CLockLocation(CLockLocation&&) (sync.cpp:43)
    138==51564==    by 0xA5D467: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
    139==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
    140==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
    141==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
    142==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    143==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    144==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    145==51564==    by 0x5559B8: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    146==51564==    by 0x4DF455: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::UniqueLock(AnnotatedMixin<std::mutex>&, char const*, char const*, int, bool) (sync.h:152)
    147==51564==    by 0xA18954: CScheduler::stop(bool) (scheduler.cpp:77)
    148==51564==  Address 0x5170c00 is 32 bytes inside a block of size 768 free'd
    149==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    150==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    151==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    152==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    153==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    154==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    155==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    156==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    157==51564==    by 0x4CC5BDF: exit (exit.c:139)
    158==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    159==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    160==51564==  Block was alloc'd at
    161==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    162==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    163==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    164==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    165==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    166==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    167==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    168==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    169==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    170==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    171==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    172==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    173==51564== 
    174==51564== Invalid write of size 8
    175==51564==    at 0x4991DB1: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
    176==51564==    by 0xA5D525: CLockLocation::CLockLocation(CLockLocation&&) (sync.cpp:43)
    177==51564==    by 0xA5D467: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
    178==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
    179==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
    180==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
    181==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    182==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    183==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    184==51564==    by 0x5559B8: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    185==51564==    by 0x4DF455: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::UniqueLock(AnnotatedMixin<std::mutex>&, char const*, char const*, int, bool) (sync.h:152)
    186==51564==    by 0xA18954: CScheduler::stop(bool) (scheduler.cpp:77)
    187==51564==  Address 0x5170bf8 is 24 bytes inside a block of size 768 free'd
    188==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    189==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    190==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    191==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    192==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    193==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    194==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    195==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    196==51564==    by 0x4CC5BDF: exit (exit.c:139)
    197==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    198==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    199==51564==  Block was alloc'd at
    200==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    201==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    202==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    203==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    204==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    205==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    206==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    207==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    208==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    209==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    210==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    211==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    212==51564== 
    213==51564== Invalid write of size 8
    214==51564==    at 0x4991D88: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
    215==51564==    by 0xA5D540: CLockLocation::CLockLocation(CLockLocation&&) (sync.cpp:43)
    216==51564==    by 0xA5D467: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
    217==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
    218==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
    219==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
    220==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    221==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    222==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    223==51564==    by 0x5559B8: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    224==51564==    by 0x4DF455: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::UniqueLock(AnnotatedMixin<std::mutex>&, char const*, char const*, int, bool) (sync.h:152)
    225==51564==    by 0xA18954: CScheduler::stop(bool) (scheduler.cpp:77)
    226==51564==  Address 0x5170c10 is 48 bytes inside a block of size 768 free'd
    227==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    228==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    229==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    230==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    231==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    232==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    233==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    234==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    235==51564==    by 0x4CC5BDF: exit (exit.c:139)
    236==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    237==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    238==51564==  Block was alloc'd at
    239==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    240==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    241==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    242==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    243==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    244==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    245==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    246==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    247==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    248==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    249==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    250==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    251==51564== 
    252==51564== Invalid write of size 8
    253==51564==    at 0x4991DC5: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
    254==51564==    by 0xA5D540: CLockLocation::CLockLocation(CLockLocation&&) (sync.cpp:43)
    255==51564==    by 0xA5D467: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
    256==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
    257==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
    258==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
    259==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    260==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    261==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    262==51564==    by 0x5559B8: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    263==51564==    by 0x4DF455: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::UniqueLock(AnnotatedMixin<std::mutex>&, char const*, char const*, int, bool) (sync.h:152)
    264==51564==    by 0xA18954: CScheduler::stop(bool) (scheduler.cpp:77)
    265==51564==  Address 0x5170c20 is 64 bytes inside a block of size 768 free'd
    266==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    267==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    268==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    269==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    270==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    271==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    272==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    273==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    274==51564==    by 0x4CC5BDF: exit (exit.c:139)
    275==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    276==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    277==51564==  Block was alloc'd at
    278==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    279==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    280==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    281==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    282==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    283==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    284==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    285==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    286==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    287==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    288==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    289==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    290==51564== 
    291==51564== Invalid write of size 8
    292==51564==    at 0x4991DB1: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
    293==51564==    by 0xA5D540: CLockLocation::CLockLocation(CLockLocation&&) (sync.cpp:43)
    294==51564==    by 0xA5D467: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
    295==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
    296==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
    297==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
    298==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    299==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    300==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    301==51564==    by 0x5559B8: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    302==51564==    by 0x4DF455: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::UniqueLock(AnnotatedMixin<std::mutex>&, char const*, char const*, int, bool) (sync.h:152)
    303==51564==    by 0xA18954: CScheduler::stop(bool) (scheduler.cpp:77)
    304==51564==  Address 0x5170c18 is 56 bytes inside a block of size 768 free'd
    305==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    306==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    307==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    308==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    309==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    310==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    311==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    312==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    313==51564==    by 0x4CC5BDF: exit (exit.c:139)
    314==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    315==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    316==51564==  Block was alloc'd at
    317==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    318==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    319==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    320==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    321==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    322==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    323==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    324==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    325==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    326==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    327==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    328==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    329==51564== 
    330==51564== Invalid write of size 4
    331==51564==    at 0xA5D54D: CLockLocation::CLockLocation(CLockLocation&&) (sync.cpp:43)
    332==51564==    by 0xA5D467: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
    333==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
    334==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
    335==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
    336==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    337==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    338==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    339==51564==    by 0x5559B8: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    340==51564==    by 0x4DF455: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::UniqueLock(AnnotatedMixin<std::mutex>&, char const*, char const*, int, bool) (sync.h:152)
    341==51564==    by 0xA18954: CScheduler::stop(bool) (scheduler.cpp:77)
    342==51564==    by 0xB05A9D: TestingSetup::~TestingSetup() (setup_common.cpp:174)
    343==51564==  Address 0x5170c38 is 88 bytes inside a block of size 768 free'd
    344==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    345==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    346==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    347==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    348==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    349==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    350==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    351==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    352==51564==    by 0x4CC5BDF: exit (exit.c:139)
    353==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    354==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    355==51564==  Block was alloc'd at
    356==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    357==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    358==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    359==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    360==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    361==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    362==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    363==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    364==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    365==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    366==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    367==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    368==51564== 
    369==51564== Invalid write of size 8
    370==51564==    at 0xA5D555: CLockLocation::CLockLocation(CLockLocation&&) (sync.cpp:43)
    371==51564==    by 0xA5D467: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
    372==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
    373==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
    374==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
    375==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    376==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    377==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    378==51564==    by 0x5559B8: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    379==51564==    by 0x4DF455: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::UniqueLock(AnnotatedMixin<std::mutex>&, char const*, char const*, int, bool) (sync.h:152)
    380==51564==    by 0xA18954: CScheduler::stop(bool) (scheduler.cpp:77)
    381==51564==    by 0xB05A9D: TestingSetup::~TestingSetup() (setup_common.cpp:174)
    382==51564==  Address 0x5170c30 is 80 bytes inside a block of size 768 free'd
    383==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    384==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    385==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    386==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    387==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    388==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    389==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    390==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    391==51564==    by 0x4CC5BDF: exit (exit.c:139)
    392==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    393==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    394==51564==  Block was alloc'd at
    395==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    396==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    397==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    398==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    399==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    400==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    401==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    402==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    403==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    404==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    405==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    406==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    407==51564== 
    408==51564== Invalid read of size 8
    409==51564==    at 0xA57487: push_lock(void*, CLockLocation const&) (sync.cpp:138)
    410==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    411==51564==    by 0x5559B8: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    412==51564==    by 0x4DF455: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::UniqueLock(AnnotatedMixin<std::mutex>&, char const*, char const*, int, bool) (sync.h:152)
    413==51564==    by 0xA18954: CScheduler::stop(bool) (scheduler.cpp:77)
    414==51564==    by 0xB05A9D: TestingSetup::~TestingSetup() (setup_common.cpp:174)
    415==51564==    by 0x4CC5A26: __run_exit_handlers (exit.c:108)
    416==51564==    by 0x4CC5BDF: exit (exit.c:139)
    417==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    418==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    419==51564==  Address 0x5170be0 is 0 bytes inside a block of size 768 free'd
    420==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    421==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    422==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    423==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    424==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    425==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    426==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    427==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    428==51564==    by 0x4CC5BDF: exit (exit.c:139)
    429==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    430==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    431==51564==  Block was alloc'd at
    432==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    433==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    434==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    435==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    436==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    437==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    438==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    439==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    440==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    441==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    442==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    443==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    444==51564== 
    445==51564== Invalid read of size 8
    446==51564==    at 0x4991E34: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
    447==51564==    by 0xA57AD0: CLockLocation::~CLockLocation() (sync.cpp:43)
    448==51564==    by 0xA5C3B9: std::pair<void*, CLockLocation>::~pair() (stl_iterator.h:1286)
    449==51564==    by 0xA5E64E: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::destroy<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*) (new_allocator.h:153)
    450==51564==    by 0xA5E5B2: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::destroy<std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*) (alloc_traits.h:497)
    451==51564==    by 0xA659B5: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::pop_back() (stl_vector.h:1226)
    452==51564==    by 0xA5855A: pop_lock() (sync.cpp:155)
    453==51564==    by 0xA584D2: LeaveCritical() (sync.cpp:177)
    454==51564==    by 0x4DF72C: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::~UniqueLock() (sync.h:169)
    455==51564==    by 0xA1899E: CScheduler::stop(bool) (scheduler.cpp:82)
    456==51564==    by 0xB05A9D: TestingSetup::~TestingSetup() (setup_common.cpp:174)
    457==51564==    by 0x4CC5A26: __run_exit_handlers (exit.c:108)
    458==51564==  Address 0x5170c10 is 48 bytes inside a block of size 768 free'd
    459==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    460==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    461==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    462==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    463==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    464==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    465==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    466==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    467==51564==    by 0x4CC5BDF: exit (exit.c:139)
    468==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    469==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    470==51564==  Block was alloc'd at
    471==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    472==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    473==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    474==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    475==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    476==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    477==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    478==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    479==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    480==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    481==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    482==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    483==51564== 
    484==51564== Invalid read of size 8
    485==51564==    at 0x4991E34: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
    486==51564==    by 0xA57AE0: CLockLocation::~CLockLocation() (sync.cpp:43)
    487==51564==    by 0xA5C3B9: std::pair<void*, CLockLocation>::~pair() (stl_iterator.h:1286)
    488==51564==    by 0xA5E64E: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::destroy<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*) (new_allocator.h:153)
    489==51564==    by 0xA5E5B2: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::destroy<std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*) (alloc_traits.h:497)
    490==51564==    by 0xA659B5: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::pop_back() (stl_vector.h:1226)
    491==51564==    by 0xA5855A: pop_lock() (sync.cpp:155)
    492==51564==    by 0xA584D2: LeaveCritical() (sync.cpp:177)
    493==51564==    by 0x4DF72C: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::~UniqueLock() (sync.h:169)
    494==51564==    by 0xA1899E: CScheduler::stop(bool) (scheduler.cpp:82)
    495==51564==    by 0xB05A9D: TestingSetup::~TestingSetup() (setup_common.cpp:174)
    496==51564==    by 0x4CC5A26: __run_exit_handlers (exit.c:108)
    497==51564==  Address 0x5170bf0 is 16 bytes inside a block of size 768 free'd
    498==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    499==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    500==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    501==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    502==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    503==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    504==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    505==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    506==51564==    by 0x4CC5BDF: exit (exit.c:139)
    507==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    508==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    509==51564==  Block was alloc'd at
    510==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    511==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    512==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    513==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    514==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    515==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    516==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    517==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    518==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    519==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    520==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    521==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    522==51564== 
    523==51564== Invalid write of size 8
    524==51564==    at 0x4991D97: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
    525==51564==    by 0xA5D525: CLockLocation::CLockLocation(CLockLocation&&) (sync.cpp:43)
    526==51564==    by 0xA5D467: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
    527==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
    528==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
    529==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
    530==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    531==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    532==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    533==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    534==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    535==51564==    by 0xA1A5E8: SingleThreadedSchedulerClient::ProcessQueue() (scheduler.cpp:161)
    536==51564==  Address 0x5170bf0 is 16 bytes inside a block of size 768 free'd
    537==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    538==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    539==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    540==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    541==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    542==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    543==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    544==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    545==51564==    by 0x4CC5BDF: exit (exit.c:139)
    546==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    547==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    548==51564==  Block was alloc'd at
    549==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    550==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    551==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    552==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    553==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    554==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    555==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    556==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    557==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    558==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    559==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    560==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    561==51564== 
    562==51564== Invalid write of size 8
    563==51564==    at 0x4991D9E: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
    564==51564==    by 0xA5D525: CLockLocation::CLockLocation(CLockLocation&&) (sync.cpp:43)
    565==51564==    by 0xA5D467: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
    566==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
    567==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
    568==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
    569==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    570==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    571==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    572==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    573==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    574==51564==    by 0xA1A5E8: SingleThreadedSchedulerClient::ProcessQueue() (scheduler.cpp:161)
    575==51564==  Address 0x5170c00 is 32 bytes inside a block of size 768 free'd
    576==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    577==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    578==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    579==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    580==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    581==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    582==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    583==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    584==51564==    by 0x4CC5BDF: exit (exit.c:139)
    585==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    586==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    587==51564==  Block was alloc'd at
    588==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    589==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    590==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    591==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    592==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    593==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    594==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    595==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    596==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    597==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    598==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    599==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    600==51564== 
    601==51564== Invalid read of size 8
    602==51564==    at 0xA57487: push_lock(void*, CLockLocation const&) (sync.cpp:138)
    603==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    604==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    605==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    606==51564==    by 0xA1A5E8: SingleThreadedSchedulerClient::ProcessQueue() (scheduler.cpp:161)
    607==51564==    by 0xA1B0CF: SingleThreadedSchedulerClient::EmptyQueue() (scheduler.cpp:201)
    608==51564==    by 0x8DE049: CMainSignals::FlushBackgroundCallbacks() (validationinterface.cpp:103)
    609==51564==    by 0xB05B4A: TestingSetup::~TestingSetup() (setup_common.cpp:177)
    610==51564==    by 0x4CC5A26: __run_exit_handlers (exit.c:108)
    611==51564==    by 0x4CC5BDF: exit (exit.c:139)
    612==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    613==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    614==51564==  Address 0x5170be0 is 0 bytes inside a block of size 768 free'd
    615==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    616==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    617==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    618==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    619==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    620==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    621==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    622==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    623==51564==    by 0x4CC5BDF: exit (exit.c:139)
    624==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    625==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    626==51564==  Block was alloc'd at
    627==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    628==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    629==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    630==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    631==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    632==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    633==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    634==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    635==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    636==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    637==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    638==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    639==51564== 
    640==51564== Invalid write of size 8
    641==51564==    at 0x4991D97: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
    642==51564==    by 0xA5D540: CLockLocation::CLockLocation(CLockLocation&&) (sync.cpp:43)
    643==51564==    by 0xA5D467: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
    644==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
    645==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
    646==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
    647==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    648==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    649==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    650==51564==    by 0x5559B8: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    651==51564==    by 0x4DF455: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::UniqueLock(AnnotatedMixin<std::mutex>&, char const*, char const*, int, bool) (sync.h:152)
    652==51564==    by 0xA68C2B: CThreadInterrupt::operator()() (threadinterrupt.cpp:25)
    653==51564==  Address 0x5170c10 is 48 bytes inside a block of size 768 free'd
    654==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    655==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    656==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    657==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    658==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    659==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    660==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    661==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    662==51564==    by 0x4CC5BDF: exit (exit.c:139)
    663==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    664==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    665==51564==  Block was alloc'd at
    666==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    667==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    668==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    669==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    670==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    671==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    672==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    673==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    674==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    675==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    676==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    677==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    678==51564== 
    679==51564== Invalid write of size 8
    680==51564==    at 0x4991D9E: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
    681==51564==    by 0xA5D540: CLockLocation::CLockLocation(CLockLocation&&) (sync.cpp:43)
    682==51564==    by 0xA5D467: std::pair<void*, CLockLocation>::pair(std::pair<void*, CLockLocation>&&) (stl_pair.h:304)
    683==51564==    by 0xA5D3B1: void __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (new_allocator.h:147)
    684==51564==    by 0xA5D00D: void std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::construct<std::pair<void*, CLockLocation>, std::pair<void*, CLockLocation> >(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, std::pair<void*, CLockLocation>&&) (alloc_traits.h:484)
    685==51564==    by 0xA5CE86: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:115)
    686==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    687==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    688==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    689==51564==    by 0x5559B8: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    690==51564==    by 0x4DF455: UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::UniqueLock(AnnotatedMixin<std::mutex>&, char const*, char const*, int, bool) (sync.h:152)
    691==51564==    by 0xA68C2B: CThreadInterrupt::operator()() (threadinterrupt.cpp:25)
    692==51564==  Address 0x5170c20 is 64 bytes inside a block of size 768 free'd
    693==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    694==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    695==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    696==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    697==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    698==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    699==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    700==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    701==51564==    by 0x4CC5BDF: exit (exit.c:139)
    702==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    703==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    704==51564==  Block was alloc'd at
    705==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    706==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    707==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    708==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    709==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    710==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    711==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    712==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    713==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    714==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    715==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    716==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    717==51564== 
    718==51564== Invalid read of size 8
    719==51564==    at 0xA5EB4A: std::pair<void*, void*>::pair<void*&, true>(void* const&, void*&) (stl_pair.h:326)
    720==51564==    by 0xA5C46B: std::pair<std::__decay_and_strip<void* const&>::__type, std::__decay_and_strip<void*&>::__type> std::make_pair<void* const&, void*&>(void* const&, void*&) (stl_pair.h:529)
    721==51564==    by 0xA57515: push_lock(void*, CLockLocation const&) (sync.cpp:141)
    722==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    723==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    724==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    725==51564==    by 0x6C7727: CTxMemPool::clear() (txmempool.cpp:600)
    726==51564==    by 0x81D4D5: UnloadBlockIndex() (validation.cpp:4584)
    727==51564==    by 0xB05BF8: TestingSetup::~TestingSetup() (setup_common.cpp:185)
    728==51564==    by 0x4CC5A26: __run_exit_handlers (exit.c:108)
    729==51564==    by 0x4CC5BDF: exit (exit.c:139)
    730==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    731==51564==  Address 0x5170be0 is 0 bytes inside a block of size 768 free'd
    732==51564==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    733==51564==    by 0xA5E79A: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::deallocate(std::pair<void*, CLockLocation>*, unsigned long) (new_allocator.h:128)
    734==51564==    by 0xA5E6F2: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::deallocate(std::allocator<std::pair<void*, CLockLocation> >&, std::pair<void*, CLockLocation>*, unsigned long) (alloc_traits.h:470)
    735==51564==    by 0xA5DB99: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_deallocate(std::pair<void*, CLockLocation>*, unsigned long) (stl_vector.h:351)
    736==51564==    by 0xA60D20: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~_Vector_base() (stl_vector.h:332)
    737==51564==    by 0xA57104: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::~vector() (stl_vector.h:680)
    738==51564==    by 0x4CC643E: __call_tls_dtors (cxa_thread_atexit_impl.c:155)
    739==51564==    by 0x4CC5B8C: __run_exit_handlers (exit.c:46)
    740==51564==    by 0x4CC5BDF: exit (exit.c:139)
    741==51564==    by 0x4236D8: fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    742==51564==    by 0x44C322: main (in /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn)
    743==51564==  Block was alloc'd at
    744==51564==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    745==51564==    by 0xA5E095: __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) (new_allocator.h:114)
    746==51564==    by 0xA5DF94: std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) (alloc_traits.h:444)
    747==51564==    by 0xA5D90D: std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) (stl_vector.h:343)
    748==51564==    by 0xA5D17F: void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_realloc_insert<std::pair<void*, CLockLocation> >(__gnu_cxx::__normal_iterator<std::pair<void*, CLockLocation>*, std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > > >, std::pair<void*, CLockLocation>&&) (vector.tcc:440)
    749==51564==    by 0xA5CED2: std::pair<void*, CLockLocation>& std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) (vector.tcc:121)
    750==51564==    by 0xA5C255: std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::push_back(std::pair<void*, CLockLocation>&&) (stl_vector.h:1201)
    751==51564==    by 0xA573FE: push_lock(void*, CLockLocation const&) (sync.cpp:135)
    752==51564==    by 0xA572A4: EnterCritical(char const*, char const*, int, void*, bool) (sync.cpp:160)
    753==51564==    by 0x5160A8: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int) (sync.h:126)
    754==51564==    by 0x4BB885: UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) (sync.h:152)
    755==51564==    by 0xA7479F: ArgsManager::GetSetting(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (system.cpp:861)
    756==51564== 
    757==51564== 
    758==51564== HEAP SUMMARY:
    759==51564==     in use at exit: 23,172,862 bytes in 1,487 blocks
    760==51564==   total heap usage: 138,583 allocs, 137,096 frees, 324,726,925 bytes allocated
    761==51564== 
    762==51564== LEAK SUMMARY:
    763==51564==    definitely lost: 0 bytes in 0 blocks
    764==51564==    indirectly lost: 0 bytes in 0 blocks
    765==51564==      possibly lost: 304 bytes in 1 blocks
    766==51564==    still reachable: 23,172,558 bytes in 1,486 blocks
    767==51564==         suppressed: 0 bytes in 0 blocks
    768==51564== Rerun with --leak-check=full to see details of leaked memory
    769==51564== 
    770==51564== For lists of detected and suppressed errors, rerun with: -s
    771==51564== ERROR SUMMARY: 167 errors from 19 contexts (suppressed: 0 from 0)
    

    hebasto commented at 11:54 am on May 13, 2020:
    • struct desctructor locks the global mutex -> Reads free’d lockstack

    I can see only locking of lockdata.dd_mutex, or did I miss?


    MarcoFalke commented at 1:24 pm on May 16, 2020:

    So reading from the bt, it looks like g_lockstack is initialized on first use. Not sure why, though. Because it is initialized on first use, it leads to invalid memory access.

    Donating the memory to the operating system at the end instead of calling the destructor fixes the problem for me.


    MarcoFalke commented at 1:26 pm on May 16, 2020:

    Is this something inherent to thread_local to construct on first use?

    Running this example program:

     0struct Foo {
     1    Mutex m_mut;
     2    Foo()
     3    {
     4        std::cout << __LINE__ << __func__ << std::endl;
     5        LOCK(m_mut);
     6    }
     7    ~Foo()
     8    {
     9        std::cout << __LINE__ << __func__ << std::endl;
    10        LOCK(m_mut);
    11    }
    12};
    13
    14void initialize()
    15{
    16}
    17
    18void test_one_input(const std::vector<uint8_t>& buffer)
    19{
    20    static Foo bar;
    21}
    

    gives me

    014Foo
    180LockStack
    284~LockStack
    319~Foo
    

    MarcoFalke commented at 1:27 pm on May 16, 2020:

    How I expect it to work from reading the code was

    0LockStack
    1Foo
    2~Foo
    3~LockStack
    

    hebasto commented at 5:18 am on May 17, 2020:

    As I understand, ~TestingSetup() locks Mutex newTaskMutex, and, consequently, uses LockStack g_lockstack.

    Having a static instance of the TestingSetup makes the destroying order unpredictable that leads to UB due to the possible usage of (writing to and reading from) g_lockstack.

    I found two cases of a static instance of the TestingSetup: https://github.com/bitcoin/bitcoin/blob/f8123d483caaee64c28be77fb5b6ae12293ddc4a/src/test/fuzz/process_messages.cpp#L19 https://github.com/bitcoin/bitcoin/blob/f8123d483caaee64c28be77fb5b6ae12293ddc4a/src/test/fuzz/process_message.cpp#L44 @MarcoFalke

    Donating the memory to the operating system at the end instead of calling the destructor fixes the problem for me.

    Which object are you talking about?


    hebasto commented at 8:23 am on May 17, 2020:

    @MarcoFalke

    I can confirm that the following patch fixes all of the memory errors mentioned in this pull:

     0diff --git a/src/sync.cpp b/src/sync.cpp
     1index 41c75302d..9b99f5cfa 100644
     2--- a/src/sync.cpp
     3+++ b/src/sync.cpp
     4@@ -89,7 +89,12 @@ LockData& GetLockData() {
     5     return *lockdata;
     6 }
     7 
     8-static thread_local LockStack g_lockstack;
     9+LockStack& GetLockStack() {
    10+    // This approach guarantees that the *lockstack object is not destroyed until after its last use.
    11+    // The operating system automatically reclaims all the memory in a program's heap when that program exits.
    12+    static thread_local LockStack* lockstack{new LockStack()};
    13+    return *lockstack;
    14+}
    15 
    16 static void potential_deadlock_detected(const std::pair<void*, void*>& mismatch, const LockStack& s1, const LockStack& s2)
    17 {
    18@@ -126,16 +131,17 @@ static void push_lock(void* c, const CLockLocation& locklocation)
    19     LockData& lockdata = GetLockData();
    20     std::lock_guard<std::mutex> lock(lockdata.dd_mutex);
    21 
    22-    g_lockstack.push_back(std::make_pair(c, locklocation));
    23+    LockStack& lockstack = GetLockStack();
    24+    lockstack.push_back(std::make_pair(c, locklocation));
    25 
    26-    for (const std::pair<void*, CLockLocation>& i : g_lockstack) {
    27+    for (const std::pair<void*, CLockLocation>& i : lockstack) {
    28         if (i.first == c)
    29             break;
    30 
    31         std::pair<void*, void*> p1 = std::make_pair(i.first, c);
    32         if (lockdata.lockorders.count(p1))
    33             continue;
    34-        lockdata.lockorders.emplace(p1, g_lockstack);
    35+        lockdata.lockorders.emplace(p1, lockstack);
    36 
    37         std::pair<void*, void*> p2 = std::make_pair(c, i.first);
    38         lockdata.invlockorders.insert(p2);
    39@@ -146,7 +152,7 @@ static void push_lock(void* c, const CLockLocation& locklocation)
    40 
    41 static void pop_lock()
    42 {
    43-    g_lockstack.pop_back();
    44+    GetLockStack().pop_back();
    45 }
    46 
    47 void EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry)
    48@@ -156,8 +162,9 @@ void EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs
    49 
    50 void CheckLastCritical(void* cs, std::string& lockname, const char* guardname, const char* file, int line)
    51 {
    52-    if (!g_lockstack.empty()) {
    53-        const auto& lastlock = g_lockstack.back();
    54+    LockStack& lockstack = GetLockStack();
    55+    if (!lockstack.empty()) {
    56+        const auto& lastlock = lockstack.back();
    57         if (lastlock.first == cs) {
    58             lockname = lastlock.second.Name();
    59             return;
    60@@ -174,14 +181,16 @@ void LeaveCritical()
    61 std::string LocksHeld()
    62 {
    63     std::string result;
    64-    for (const std::pair<void*, CLockLocation>& i : g_lockstack)
    65+    LockStack& lockstack = GetLockStack();
    66+    for (const std::pair<void*, CLockLocation>& i : lockstack)
    67         result += i.second.ToString() + std::string("\n");
    68     return result;
    69 }
    70 
    71 void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs)
    72 {
    73-    for (const std::pair<void*, CLockLocation>& i : g_lockstack)
    74+    LockStack& lockstack = GetLockStack();
    75+    for (const std::pair<void*, CLockLocation>& i : lockstack)
    76         if (i.first == cs)
    77             return;
    78     tfm::format(std::cerr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, LocksHeld());
    79@@ -190,7 +199,8 @@ void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine,
    80 
    81 void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs)
    82 {
    83-    for (const std::pair<void*, CLockLocation>& i : g_lockstack) {
    84+    LockStack& lockstack = GetLockStack();
    85+    for (const std::pair<void*, CLockLocation>& i : lockstack) {
    86         if (i.first == cs) {
    87             tfm::format(std::cerr, "Assertion failed: lock %s held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, LocksHeld());
    88             abort();
    

    Going to investigate for any regression.


    MarcoFalke commented at 10:37 am on May 17, 2020:

    Having a static instance of the TestingSetup makes the destroying order unpredictable

    I wasn’t aware of that. I assumed that the order globals are destroyed is the inverse order of how they were constructed.


    hebasto commented at 10:42 am on May 17, 2020:

    I wasn’t aware of that. I assumed that the order globals are destroyed is the inverse order of how they were constructed.

    That is correct. But if globals are defined in different translation units then the order of how them are constructed is unpredictable.


    MarcoFalke commented at 10:48 am on May 17, 2020:

    TIL

    Anyway, I did the same changes as in your comment and for me that fixed the problems.


    promag commented at 10:48 am on May 17, 2020:
    Lets move them all to same unit :trollface:

    MarcoFalke commented at 10:49 am on May 17, 2020:
    main.cpp, maybe?

    hebasto commented at 11:24 am on May 17, 2020:

    Lets move them all to same unit :trollface:

    main.cpp, maybe?

    What about unit tests?


    hebasto commented at 12:11 pm on May 17, 2020:
  47. MarcoFalke changes_requested
  48. MarcoFalke commented at 3:06 pm on May 12, 2020: member

    I still get the error free(): corrupted unsorted chunks when fuzzing on focal with enable-debug:

     0root@042ac26113c2:/bitcoin-core# /bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn -runs=1 /bitcoin-core/ci/scratch/qa-assets/fuzz_seed_corpus/process_message_blocktxn
     1INFO: Seed: 2368542291
     2INFO: Loaded 1 modules   (115207 inline 8-bit counters): 115207 [0x55d1f460d748, 0x55d1f462994f), 
     3INFO: Loaded 1 PC tables (115207 PCs): 115207 [0x55d1f4629950,0x55d1f47eb9c0), 
     4INFO:      304 files found in /bitcoin-core/ci/scratch/qa-assets/fuzz_seed_corpus/process_message_blocktxn
     5INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 1007323 bytes
     6INFO: seed corpus: files: 304 min: 1b max: 1007323b total: 7665972b rss: 76Mb
     7[#305](/bitcoin-bitcoin/305/)	INITED cov: 3511 ft: 8239 corp: 229/480Kb exec/s: 0 rss: 84Mb
     8[#305](/bitcoin-bitcoin/305/)	DONE   cov: 3511 ft: 8239 corp: 229/480Kb lim: 301441 exec/s: 0 rss: 84Mb
     9Done 305 runs in 0 second(s)
    10free(): corrupted unsorted chunks
    11==51558== ERROR: libFuzzer: deadly signal
    12    [#0](/bitcoin-bitcoin/0/) 0x55d1f3755930 in __sanitizer_print_stack_trace (/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn+0x397930)
    13    [#1](/bitcoin-bitcoin/1/) 0x55d1f3701c38 in fuzzer::PrintStackTrace() (/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn+0x343c38)
    14    [#2](/bitcoin-bitcoin/2/) 0x55d1f36e6d83 in fuzzer::Fuzzer::CrashCallback() (/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/process_message_blocktxn+0x328d83)
    15    [#3](/bitcoin-bitcoin/3/) 0x7f7660b583bf  (/lib/x86_64-linux-gnu/libpthread.so.0+0x153bf)
    16    [#4](/bitcoin-bitcoin/4/) 0x7f76607bf18a in __libc_signal_restore_set /build/glibc-YYA7BZ/glibc-2.31/signal/../sysdeps/unix/sysv/linux/internal-signals.h:86:3
    17    [#5](/bitcoin-bitcoin/5/) 0x7f76607bf18a in raise /build/glibc-YYA7BZ/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:48:3
    18    [#6](/bitcoin-bitcoin/6/) 0x7f766079e858 in abort /build/glibc-YYA7BZ/glibc-2.31/stdlib/abort.c:79:7
    19    [#7](/bitcoin-bitcoin/7/) 0x7f76608093ed in __libc_message /build/glibc-YYA7BZ/glibc-2.31/libio/../sysdeps/posix/libc_fatal.c:155:5
    20    [#8](/bitcoin-bitcoin/8/) 0x7f766081147b in malloc_printerr /build/glibc-YYA7BZ/glibc-2.31/malloc/malloc.c:5347:3
    21    [#9](/bitcoin-bitcoin/9/) 0x7f76608131c1 in _int_free /build/glibc-YYA7BZ/glibc-2.31/malloc/malloc.c:4356:2
    22    [#10](/bitcoin-bitcoin/10/) 0x7f7660816a0c in __GI___libc_free /build/glibc-YYA7BZ/glibc-2.31/malloc/malloc.c:3125:3
    23    [#11](/bitcoin-bitcoin/11/) 0x7f7660816a0c in tcache_thread_shutdown /build/glibc-YYA7BZ/glibc-2.31/malloc/malloc.c:2964:4
    24    [#12](/bitcoin-bitcoin/12/) 0x7f7660816a0c in __malloc_arena_thread_freeres /build/glibc-YYA7BZ/glibc-2.31/malloc/arena.c:951:3
    25    [#13](/bitcoin-bitcoin/13/) 0x7f7660b4c62e in start_thread /build/glibc-YYA7BZ/glibc-2.31/nptl/pthread_create.c:491:3
    26    [#14](/bitcoin-bitcoin/14/) 0x7f766089b102 in clone /build/glibc-YYA7BZ/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
    27
    28NOTE: libFuzzer has rudimentary signal handlers.
    29      Combine libFuzzer with AddressSanitizer or similar for better crash reports.
    30SUMMARY: libFuzzer: deadly signal
    31MS: 0 ; base unit: 0000000000000000000000000000000000000000
    32
    33
    34artifact_prefix='./'; Test unit written to ./crash-da39a3ee5e6b4b0d3255bfef95601890afd80709
    35Base64: 
    
  49. hebasto commented at 12:11 pm on May 17, 2020: member

    Updated 6bc686839a7cc09e3586e2a47ae4f16b5d918d3a -> d34871883ce116b8ba4e3add5d5330215a0b16f3 (pr18881.06 -> pr18881.07, diff):

  50. in src/sync.cpp:97 in d34871883c outdated
    100 }
    101 
    102-static thread_local LockStack g_lockstack;
    103+LockStack& GetLockStack() {
    104+    // This approach guarantees that the *lockstack object is not destroyed until after its last use.
    105+    // The operating system automatically reclaims all the memory in a program's heap when that program exits.
    


    MarcoFalke commented at 12:15 pm on May 17, 2020:
    Maybe also mention that this is only safe to do because the object happens to have a trivial destructor?
  51. in src/sync.cpp:165 in d34871883c outdated
    161@@ -162,8 +162,9 @@ void EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs
    162 
    163 void CheckLastCritical(void* cs, std::string& lockname, const char* guardname, const char* file, int line)
    164 {
    165-    if (!g_lockstack.empty()) {
    166-        const auto& lastlock = g_lockstack.back();
    167+    LockStack& lockstack = GetLockStack();
    


    MarcoFalke commented at 12:15 pm on May 17, 2020:
    0    const LockStack& lockstack = GetLockStack();
    
  52. in src/sync.cpp:184 in d34871883c outdated
    180@@ -180,14 +181,16 @@ void LeaveCritical()
    181 std::string LocksHeld()
    182 {
    183     std::string result;
    184-    for (const std::pair<void*, CLockLocation>& i : g_lockstack)
    185+    LockStack& lockstack = GetLockStack();
    


    MarcoFalke commented at 12:16 pm on May 17, 2020:
    0    const LockStack& lockstack = GetLockStack();
    
  53. in src/sync.cpp:192 in d34871883c outdated
    189 }
    190 
    191 void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs)
    192 {
    193-    for (const std::pair<void*, CLockLocation>& i : g_lockstack)
    194+    LockStack& lockstack = GetLockStack();
    


    MarcoFalke commented at 12:16 pm on May 17, 2020:
    same
  54. in src/sync.cpp:202 in d34871883c outdated
    198@@ -196,7 +199,8 @@ void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine,
    199 
    200 void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs)
    201 {
    202-    for (const std::pair<void*, CLockLocation>& i : g_lockstack) {
    203+    LockStack& lockstack = GetLockStack();
    


    MarcoFalke commented at 12:16 pm on May 17, 2020:
    same
  55. MarcoFalke approved
  56. MarcoFalke commented at 12:16 pm on May 17, 2020: member
    might test later ACK
  57. hebasto force-pushed on May 17, 2020
  58. hebasto commented at 1:01 pm on May 17, 2020: member

    Updated d34871883ce116b8ba4e3add5d5330215a0b16f3 -> f5c00ba32a041108d0c7c7c8f4c5709b82e1e91a (pr18881.07 -> pr18881.08, diff):

  59. MarcoFalke commented at 1:13 pm on May 17, 2020: member
    ACK f5c00ba32a041108d0c7c7c8f4c5709b82e1e91a
  60. MarcoFalke commented at 1:30 pm on May 17, 2020: member
     0=================================================================
     1
     2==28222==ERROR: LeakSanitizer: detected memory leaks
     3
     4Direct leak of 240 byte(s) in 10 object(s) allocated from:
     5
     6    [#0](/bitcoin-bitcoin/0/) 0x5559dd5b8762 in operator new(unsigned long) (/home/travis/build/bitcoin/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x2e23762)
     7
     8    [#1](/bitcoin-bitcoin/1/) 0x5559ded68cff in GetLockStack() /home/travis/build/bitcoin/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/sync.cpp:97:46
     9
    10    [#2](/bitcoin-bitcoin/2/) 0x5559ded68eb9 in EnterCritical(char const*, char const*, int, void*, bool) /home/travis/build/bitcoin/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/sync.cpp:162:5
    11
    12    [#3](/bitcoin-bitcoin/3/) 0x5559ddcf94f9 in UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::Enter(char const*, char const*, int) /home/travis/build/bitcoin/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/./sync.h:126:9
    13
    14Direct leak of 96 byte(s) in 4 object(s) allocated from:
    15
    16    [#0](/bitcoin-bitcoin/0/) 0x5559dd5b8762 in operator new(unsigned long) (/home/travis/build/bitcoin/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x2e23762)
    17
    18    [#1](/bitcoin-bitcoin/1/) 0x5559ded68cff in GetLockStack() /home/travis/build/bitcoin/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/sync.cpp:97:46
    19
    20    [#2](/bitcoin-bitcoin/2/) 0x5559ded68eb9 in EnterCritical(char const*, char const*, int, void*, bool) /home/travis/build/bitcoin/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/sync.cpp:162:5
    21
    22    [#3](/bitcoin-bitcoin/3/) 0x5559dd8f1455 in CCheckQueueControl<checkqueue_tests::FakeCheck>::CCheckQueueControl(CCheckQueue<checkqueue_tests::FakeCheck>*) /home/travis/build/bitcoin/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/./checkqueue.h:184:13
    23
    24    [#4](/bitcoin-bitcoin/4/) 0x7fa81886cbcc  (/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1+0x11bcc)
    25
    26Direct leak of 24 byte(s) in 1 object(s) allocated from:
    27
    28    [#0](/bitcoin-bitcoin/0/) 0x5559dd5b8762 in operator new(unsigned long) (/home/travis/build/bitcoin/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x2e23762)
    29
    30    [#1](/bitcoin-bitcoin/1/) 0x5559ded68cff in GetLockStack() /home/travis/build/bitcoin/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/sync.cpp:97:46
    31
    32    [#2](/bitcoin-bitcoin/2/) 0x5559ded68eb9 in EnterCritical(char const*, char const*, int, void*, bool) /home/travis/build/bitcoin/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/sync.cpp:162:5
    33
    34    [#3](/bitcoin-bitcoin/3/) 0x5559dd8ede65 in CCheckQueueControl<checkqueue_tests::FrozenCleanupCheck>::CCheckQueueControl(CCheckQueue<checkqueue_tests::FrozenCleanupCheck>*) /home/travis/build/bitcoin/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/./checkqueue.h:184:13
    35
    36    [#4](/bitcoin-bitcoin/4/) 0x5559dd8aa640 in std::__invoke_result<checkqueue_tests::test_CheckQueue_FrozenCleanup::test_method()::$_5>::type std::__invoke<checkqueue_tests::test_CheckQueue_FrozenCleanup::test_method()::$_5>(checkqueue_tests::test_CheckQueue_FrozenCleanup::test_method()::$_5&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/invoke.h:95:14
    37
    38    [#5](/bitcoin-bitcoin/5/) 0x5559dd8aa640 in decltype(std::__invoke(_S_declval<0ul>())) std::thread::_Invoker<std::tuple<checkqueue_tests::test_CheckQueue_FrozenCleanup::test_method()::$_5> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/thread:234
    39
    40    [#6](/bitcoin-bitcoin/6/) 0x5559dd8aa640 in std::thread::_Invoker<std::tuple<checkqueue_tests::test_CheckQueue_FrozenCleanup::test_method()::$_5> >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/thread:243
    41
    42    [#7](/bitcoin-bitcoin/7/) 0x5559dd8aa640 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<checkqueue_tests::test_CheckQueue_FrozenCleanup::test_method()::$_5> > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/thread:186
    43
    44Indirect leak of 1440 byte(s) in 15 object(s) allocated from:
    45
    46    [#0](/bitcoin-bitcoin/0/) 0x5559dd5b8762 in operator new(unsigned long) (/home/travis/build/bitcoin/bitcoin/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x2e23762)
    47
    48    [#1](/bitcoin-bitcoin/1/) 0x5559ded721ff in __gnu_cxx::new_allocator<std::pair<void*, CLockLocation> >::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ext/new_allocator.h:111:27
    49
    50    [#2](/bitcoin-bitcoin/2/) 0x5559ded721ff in std::allocator_traits<std::allocator<std::pair<void*, CLockLocation> > >::allocate(std::allocator<std::pair<void*, CLockLocation> >&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/alloc_traits.h:436
    51
    52    [#3](/bitcoin-bitcoin/3/) 0x5559ded721ff in std::_Vector_base<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::_M_allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_vector.h:172
    53
    54    [#4](/bitcoin-bitcoin/4/) 0x5559ded70a61 in void std::vector<std::pair<void*, CLockLocation>, std::allocator<std::pair<void*, CLockLocation> > >::emplace_back<std::pair<void*, CLockLocation> >(std::pair<void*, CLockLocation>&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/vector.tcc:105:4
    55
    56SUMMARY: AddressSanitizer: 1800 byte(s) leaked in 30 allocation(s).
    57
    58Makefile:17661: recipe for target 'test/checkqueue_tests.cpp.test' failed
    59
    60make[3]: *** [test/checkqueue_tests.cpp.test] Error 1
    
  61. hebasto force-pushed on May 18, 2020
  62. hebasto force-pushed on May 18, 2020
  63. MarcoFalke commented at 10:27 am on May 18, 2020: member
    Was this a false positive or a true one? If false, we shouldn’t change our code for their bug, but add it to the suppressions.
  64. hebasto commented at 10:30 am on May 18, 2020: member

    @MarcoFalke

    Was this a false positive or a true one? If false, we shouldn’t change our code for their bug, but add it to the suppressions.

    The main reason why thread_local is not usable to track mutexes that are used in destructors is the following statement from https://en.cppreference.com/w/cpp/utility/program/exit:

    The last destructor for thread-local objects is sequenced-before the first destructor for a static object

  65. MarcoFalke commented at 10:43 am on May 18, 2020: member

    Ok, fair enough. I think I am giving up on C++. Is your work based on #18851? If yes, maybe add the comment that the map is append only (theoretically unbounded growth) and optionally a co-author.

    Otherwise Concept ACK. Will test if this fixes my problem when this is ready for review.

  66. hebasto commented at 10:48 am on May 18, 2020: member

    Is your work based on #18851?

    Yes. The commit message is borrowed from #18851 as I keep improving my English :D

    If yes, maybe add the comment that the map is append only (theoretically unbounded growth) and optionally a co-author.

    That is not the case due to the map shrinking: https://github.com/bitcoin/bitcoin/blob/daa2bcc8e55b4ccc41bec55cbd6a7d6f633e9e6f/src/sync.cpp#L163-L165

  67. hebasto force-pushed on May 18, 2020
  68. hebasto commented at 10:53 am on May 18, 2020: member

    Updated daa2bcc8e55b4ccc41bec55cbd6a7d6f633e9e6f -> 77b41b79d2e09ff774624a73cda7213abf26c420 (pr18881.09 -> pr18881.11, diff):

    If yes, maybe add … a co-author.

  69. hebasto force-pushed on May 18, 2020
  70. in src/sync.cpp:198 in 77b41b79d2 outdated
    192@@ -179,15 +193,23 @@ void LeaveCritical()
    193 
    194 std::string LocksHeld()
    195 {
    196+    LockData& lockdata = GetLockData();
    197+    std::lock_guard<std::mutex> lock(lockdata.dd_mutex);
    


    MarcoFalke commented at 1:57 pm on May 18, 2020:
    Locking a non-recursive mutex that is already locked is undefined behavior

    hebasto commented at 3:27 pm on May 18, 2020:
  71. MarcoFalke approved
  72. MarcoFalke commented at 1:57 pm on May 18, 2020: member

    Tested ACK 77b41b79d2e09ff774624a73cda7213abf26c420, beside newly introduced UB 🏞

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3Tested ACK 77b41b79d2e09ff774624a73cda7213abf26c420, beside newly introduced UB 🏞
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUgdEQv9FPHYulbA/8DmnWuyrbLw3yJKdfzAe2KP8HlCPqO72ALPWkueZye0ePXs
     8slutkyOVRR/xUeQFzDDtxvlhhyNzX3hE2lnGXtlphK9UT117J/XtvDFYcNEcyVag
     9SfMJGI83O6AXl6pWh6tLs8iex7LgsRMgW4D7k4BbYrn6j5+p3DSw4JsZOMa8Dow+
    10CSa69TecquL+VXxcLTvw7TPkJAEp8LwqLyPpbxXrWW/CVfasvhAkaN6DgznH/F2U
    11tgoo5gQeHrdQaaPvDRRg5w9681MPXD9dknbhnO7spdMNyU9A226pYHd9yXlXX7ci
    12Gd2N+STZPN1wEw9yq8zfKy1yKWBmeIsDXBoihbOyCNw2cGC22K5QV9S5U80htz2O
    13cSbE7tJlg4KGtHydh30PCBb+vJ0OiLvjCnienfn9aFpsLq+h1DUH6xA4o4DevrzJ
    14snvrDo3Szwmn63YCfFQpsJejJf+rq3Q5Bz+mRs8OpM1mwepu1raj/2XIWwR5Ps+W
    15NWCBbF3y
    16=u6qk
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash 5480a24c35f54d72074b6b4f29e9e36383f47a92ab417d18a34b223ba64f996f -

  73. hebasto force-pushed on May 18, 2020
  74. hebasto force-pushed on May 18, 2020
  75. hebasto force-pushed on May 18, 2020
  76. hebasto commented at 3:35 pm on May 18, 2020: member

    Updated 77b41b79d2e09ff774624a73cda7213abf26c420 -> 068264fcbb8af47f0df676cd088154d7956819d2 (pr18881.11 -> pr18881.13, diff):

    Locking a non-recursive mutex that is already locked is undefined behavior

  77. Prevent UB in DeleteLock() function 458992b06d
  78. refactor: Add LockStackItem type alias 8d8921abd3
  79. refactor: Add LockPair type alias f511f61dda
  80. refactor: Refactor duplicated code into LockHeld() 58e6881bc5
  81. Replace thread_local g_lockstack with a mutex-protected map
    This change prevents UB in case of early g_lockstack destroying.
    
    Co-authored-by: Wladimir J. van der Laan <laanwj@protonmail.com>
    26c093a995
  82. hebasto force-pushed on May 18, 2020
  83. hebasto commented at 10:41 pm on May 18, 2020: member

    Updated 068264fcbb8af47f0df676cd088154d7956819d2 -> 26c093a9957756f3743c2347fe0abd90f81159c4 (pr18881.13 -> pr18881.14, diff):

    • dropped technically incorrect mention of “trivial destructors”
    • replaced the raw pointer to the instance of LockData with a reference as we are not going to apply delete operator to that pointer
  84. MarcoFalke commented at 10:48 pm on May 18, 2020: member
    What do you mean with “technically incorrect”? https://en.cppreference.com/w/cpp/language/destructor#Trivial_destructor
  85. hebasto commented at 11:11 pm on May 18, 2020: member

    What do you mean with “technically incorrect”? https://en.cppreference.com/w/cpp/language/destructor#Trivial_destructor

    1. ibid:

    A trivial destructor is a destructor that performs no action. Objects with trivial destructors don’t require a delete-expression and may be disposed of by simply deallocating their storage.

    1. having a trivial destructor is important for the destroying order. As we are not going to destroy LockData instance, this requirement is not relevant

    2. with the latest push the static function-local lock_data variable is a reference and is not an object

    More details: https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables

  86. MarcoFalke commented at 1:00 am on May 19, 2020: member

    As we are not going to destroy LockData instance, this requirement is not relevant

    Why not? Assuming ~LockData had side effects, then not calling the destructor is going to miss those side effects.

  87. DrahtBot commented at 1:27 am on May 19, 2020: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #18635 (Replace -Wthread-safety-analysis with broader -Wthread-safety by hebasto)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  88. MarcoFalke commented at 12:25 pm on May 19, 2020: member
    And if this was somehow “incorrect” then LogInstance should also be adjusted to be consistent
  89. hebasto commented at 5:35 am on May 20, 2020: member

    I’ll try to elaborate my opinion :)

    https://github.com/bitcoin/bitcoin/blob/068264fcbb8af47f0df676cd088154d7956819d2/src/sync.cpp#L98 @MarcoFalke

    What do you mean with “technically incorrect”? https://en.cppreference.com/w/cpp/language/destructor#Trivial_destructor

    1. I mean that among LockData type and its subtypes only using LockPair = std::pair<void*, void*>; and std::mutex have trivial desctructors. This could be easily verified with the std::is_trivially_destructible type trait.

    An implicitly-defined destructor, i.e., generated by the compiler, is not the same as a trivial one.

    1. Agree that if we are going do not destruct a heap-allocated object until the program termination, it is pointless to provide a user-defined destructor with any side effects. If this statement is required to be added to the code as a comment, that comment should refer to “not having an explicit desctructor” or “having a implicit desctructor”, but not to “a trivial desctructor”.

    And if this was somehow “incorrect” then LogInstance should also be adjusted to be consistent

    The only difference is that the function-local static g_logger is a raw pointer that, in theory, should be deleted.

    In this PR the function-local static lock_data is a reference, and this approach explicitly shows our intention do not delete the heap-allocated object at all.

    If the above arguments are convincing for our community, I agree that making g_logger a reference is good for consistency.

  90. MarcoFalke commented at 11:38 am on May 22, 2020: member

    If this statement is required to be added to the code as a comment, that comment should refer to “not having an explicit desctructor” or “having a implicit desctructor”, but not to “a trivial desctructor”.

    The statement has been added to the logger, so I don’t see why it shouldn’t be added here.

    reference, and this approach explicitly shows our intention do not delete the heap-allocated object at all.

    I wasn’t aware that this style is used to indicate that delete will not be applied, but fine with me. Functionally * and & are identical.

     0#include <iostream>
     1
     2struct A {
     3  A() { std::cout << __func__ << std::endl; }
     4  ~A() { std::cout << __func__ << std::endl; }
     5};
     6
     7int main() {
     8  std::cout << "start " << __func__ << std::endl;
     9  static A a;
    10  static A *b = new A();
    11  static A &c = *new A();
    12  std::cout << "end   " << __func__ << std::endl;
    13}
    
    0start main
    1A
    2A
    3A
    4end   main
    5~A
    
  91. MarcoFalke commented at 11:50 am on May 22, 2020: member

    re-ACK 26c093a9957756f3743c2347fe0abd90f81159c4 only change since last review is removing undefined behaviour πŸš—

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3re-ACK 26c093a9957756f3743c2347fe0abd90f81159c4 only change since last review is removing undefined behaviour πŸš—
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUifmwwAs+llsO+ADQ05xZMwCoY0YQ5Zi4w65QVdoRIq9rrajfvDOSyJT09/p2d/
     8SiJN1SbB1PWFpxW0xPpT9CfAs1AhSnMGtEtm7xsllv5m/X+lsDPHqgsbN0DcfUeE
     9Q3CnDFklxI7JUOJkcHusmRB9ETxWRJPQ0Hx79OGImUbubdB32rLdsSqfw4oraFzn
    10bUY1TV76e+IB37zbYiCwiTr1EUOBu1DUV7FBr6AycYRrKMWXO2lPAGqlrOD+Orwo
    11fyWA2RAcVUbItktWDfy2D9zB8m2DT/HUYr/3DY7P7J6SotirPYQAbaHQO51K4NAo
    12PAAss/uwkX1zpXhP3hxgLBtKvixOTvZANHf6ch1dSvRrz3XyY0xCT0Z4XuL7dCJk
    13aGE6AcLzer5h46dfM2Bu3exFSRSaSvqLYks0Jv+b50m9U25+2W7XvJ4IhPovPlpY
    14/DiOQwMX1DteOd4h9PHSFl6BTLr8eDzPnNDpTue4EzQxXV7BtG++d3nyI1Uhp8OX
    15VVDT2gg9
    16=UHOn
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash 27744a6864db90d25a36be70b128da2a91330c24db6afd49a7dd4c0d2c53111c -

  92. hebasto commented at 12:03 pm on May 22, 2020: member

    @MarcoFalke

    If this statement is required to be added to the code as a comment, that comment should refer to “not having an explicit desctructor” or “having a implicit desctructor”, but not to “a trivial desctructor”.

    The statement has been added to the logger, so I don’t see why it shouldn’t be added here.

    https://github.com/bitcoin/bitcoin/blob/b5c423c48e094bd098e11c3d1f57acae7502a4da/src/logging.cpp#L25-L26

    That is not the case in so far as the Logger class has no trivial destructor. One could check this with a patch:

    0--- a/src/logging.cpp
    1+++ b/src/logging.cpp
    2@@ -8,6 +8,8 @@
    3 #include <util/time.h>
    4 
    5 #include <mutex>
    6+#include <type_traits>
    7+static_assert(std::is_trivially_destructible<BCLog::Logger>::value, "Logger has no trivial ctor.");
    8 
    9 const char * const DEFAULT_DEBUGLOGFILE = "debug.log";
    

    and compile with an error:

    0logging.cpp:12:1: error: static assertion failed: Logger has no trivial ctor.
    
  93. in src/sync.cpp:88 in 458992b06d outdated
    93+
    94 LockData& GetLockData() {
    95-    static LockData lockdata;
    96-    return lockdata;
    97+    // This approach guarantees that the object is not destroyed until after its last use.
    98+    // The operating system automatically reclaims all the memory in a program's heap when that program exits.
    


    MarcoFalke commented at 12:09 pm on May 22, 2020:
    0    // The operating system automatically reclaims all the memory in a program's heap when that program exits.
    1    // Since the destructor is never called, the object and all its members must have an implicit destructor.
    

    hebasto commented at 12:49 pm on May 22, 2020:
  94. doc: Add and fix comments about never destroyed objects 90eb027204
  95. hebasto commented at 12:49 pm on May 22, 2020: member

    Updated 26c093a9957756f3743c2347fe0abd90f81159c4 -> 90eb027204f5a9d7c00fa97d4112243bd37a9012 (pr18881.14 -> pr18881.15, diff):

  96. MarcoFalke commented at 1:41 pm on May 22, 2020: member

    re-ACK 90eb027204, only change is new doc commit πŸ‘ 

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3re-ACK 90eb027204, only change is new doc commit πŸ‘ 
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUjBJQv8D4l/8DutA799ti+iOrxhVDJh48fWd71nn2WKqcyVFJ9Y6G18v2ASlNOz
     8SrVnXhIUv/8jWgT5kOlqNw+UBMSLxNvv5NvYkchjQNYvHe5UfMrS8kWSqC6BYubc
     9UuPt+g6wV/Y+I9umkuH46Pk26iwqmVTJh86WbA1syjclNTCm1PEfs6tEbxB5bn7+
    10fBJQBQaV4J886hy1tRGK1FDNGQ93pNg88fgHdyoVMFsA4kP6utK/E93WshfV238i
    11Q9d3jiZSVzX5rZSId3Z3cYJMhGcXqC76ZT8tl+v3IX7ErS4Rf+AFyp813L/eWpDD
    12mHkImUprvIUtNkkZkjBPfAFeKWWG0gsLcfGU4/e+TAZ7R4vIm4v6fVmcunY5WEbE
    1364Qm5nq7LYOeOXi8XvvHug2l3zS67ZoTeEtGJhEiF0+rcqTgsv/bACr8FksBheu9
    14SZxUADkbahNnUv+22sEd+Nj2k50dGJOev/H50od1/gvt0E8vydUSz/P+g9NfXJyo
    15uiKec1Pw
    16=oyNZ
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash 5124182a0b09070ce2424a477f0c8ebc1bc2c756ae24de2a66e6948ffd673c33 -

  97. MarcoFalke commented at 1:42 pm on May 22, 2020: member
    Would be nice to get this merged soon, so that I don’t have to pull in this branch every time for fuzzing.
  98. ryanofsky approved
  99. ryanofsky commented at 4:33 pm on May 22, 2020: member

    Concept ACK +0.5. The DeleteLock fix makes sense and I really like the code cleanups, but I don’t understand the thread_local change.

    Code review ACK 90eb027204f5a9d7c00fa97d4112243bd37a9012 because all the changes look correct and safe. But I don’t know the purpose of commit 26c093a9957756f3743c2347fe0abd90f81159c4 “Replace thread_local g_lockstack with a mutex-protected map (5/6).” It seems like it could have a bad impact on debug performance, and the commit message and PR description don’t give a reason for the change.

    re: PR Description #18881#issue-413323554

    This PR:

    • fixes #18824
    • adds Construct On First Use idiom documentation

    Related to #15233.

    Would suggest updating the PR description to:

    • Summarize what the UB behavior is so it isn’t necessary to read a different github issue
    • Give a rationale for replacing the thread_local in the last commit
    • Drop the construct idiom text if it’s no longer relevant
    • Link to #18824 and #15233 at the bottom, and clarify if only the first commit is needed to fix bug #18824, or if the thread_local commit is needed too
  100. MarcoFalke commented at 4:51 pm on May 22, 2020: member

    Several cases of UB are fixed here.

    • The first commit fixes the one described in #18824
    • The 26c093a commit fixes one described in #18881#pullrequestreview-410137892
  101. ryanofsky commented at 5:05 pm on May 22, 2020: member

    Several cases of UB are fixed here.

    Thanks, I definitely think the PR description needs to be improved here and summarize what it is changing and give a clue about how the thread_local change fixes the second problem. If we don’t know why the thread local change fixes it, the PR description should say that and not try to be mysterious

  102. hebasto commented at 5:05 pm on May 22, 2020: member

    @ryanofsky

    Would suggest updating the PR description to:

    • Summarize what the UB behavior is so it isn’t necessary to read a different github issue

    • Give a rationale for replacing the thread_local in the last commit

    • Drop the construct idiom text if it’s no longer relevant

    • Link to #18824 and #15233 at the bottom, and clarify if only the first commit is needed to fix bug #18824, or if the thread_local commit is needed too

    Thank you for review. The PR description has been updated. Sometimes it seems the C++ is much easier to express ideas than English :)

  103. ryanofsky commented at 5:16 pm on May 22, 2020: member
    re-ACK. Thanks for updating the PR description, this looks good to me. I’m pretty sure there should be a more efficient way to stop referencing the thread_local after it is destroyed (perhaps just resetting the reference in the thread_local destructor) without replacing the thread_local with a map with frequently added & removed entries. But this only affects debugging and probably isn’t a big deal.
  104. MarcoFalke commented at 6:04 pm on May 22, 2020: member
    I am planning to merge this next week unless there are objections or outstanding action items
  105. ryanofsky commented at 6:40 pm on May 22, 2020: member

    I am planning to merge this next week unless there are objections or outstanding action items

    :+1: and seems fine to merge earlier, too. None of this code is even compiled unless debugging is turned on.

  106. MarcoFalke merged this on May 26, 2020
  107. MarcoFalke closed this on May 26, 2020

  108. hebasto deleted the branch on May 26, 2020
  109. sidhujag referenced this in commit c8b5293c9b on May 27, 2020
  110. jasonbcox referenced this in commit 8b4530e454 on Sep 22, 2020
  111. kittywhiskers referenced this in commit 6bf96e2660 on Oct 8, 2021
  112. kittywhiskers referenced this in commit ec2753a8ba on Oct 12, 2021
  113. PastaPastaPasta referenced this in commit 08418c582a on Oct 12, 2021
  114. pravblockc referenced this in commit 6b43103f1a on Nov 18, 2021
  115. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me