Fix uninitialized atomic variables #10819

pull promag wants to merge 1 commits into bitcoin:master from promag:2017-07-fix-unitialized-atomic changing 3 files +4 −4
  1. promag commented at 10:32 PM on July 13, 2017: member

    This PR fixes uninitialized atomic variables that caused some errors when running with valgrind:

    ==30439== Thread 5 bitcoin-scheduler:
    ==30439== Conditional jump or move depends on uninitialised value(s)
    ==30439==    at 0x6C8E0F: MaybeCompactWalletDB() (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x1863F3: std::_Function_handler<void (), void (*)()>::_M_invoke(std::_Any_data const&) (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x187D38: std::function<void ()>::operator()() const (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x5BEC84: Repeat(CScheduler*, std::function<void ()>, long) (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x5C3683: void boost::_bi::list3<boost::_bi::value<CScheduler*>, boost::_bi::value<std::function<void ()> >, boost::_bi::value<long> >::operator()<void (*)(CScheduler*, std::function<void ()>, long), boost::_bi::list0>(boost::_bi::type<void>, void (*&)(CScheduler*, std::function<void ()>, long), boost::_bi::list0&, int) (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x5C2ACF: boost::_bi::bind_t<void, void (*)(CScheduler*, std::function<void ()>, long), boost::_bi::list3<boost::_bi::value<CScheduler*>, boost::_bi::value<std::function<void ()> >, boost::_bi::value<long> > >::operator()() (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x5C1AAE: std::_Function_handler<void (), boost::_bi::bind_t<void, void (*)(CScheduler*, std::function<void ()>, long), boost::_bi::list3<boost::_bi::value<CScheduler*>, boost::_bi::value<std::function<void ()> >, boost::_bi::value<long> > > >::_M_invoke(std::_Any_data const&) (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x187D38: std::function<void ()>::operator()() const (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x5BE914: CScheduler::serviceQueue() (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x1A2239: boost::_mfi::mf0<void, CScheduler>::operator()(CScheduler*) const (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x19A233: void boost::_bi::list1<boost::_bi::value<CScheduler*> >::operator()<boost::_mfi::mf0<void, CScheduler>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf0<void, CScheduler>&, boost::_bi::list0&, int) (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x1907EB: boost::_bi::bind_t<void, boost::_mfi::mf0<void, CScheduler>, boost::_bi::list1<boost::_bi::value<CScheduler*> > >::operator()() (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==  Uninitialised value was created by a heap allocation
    ==30439==    at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==30439==    by 0x664514: CWallet::CreateWalletFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x6673A5: CWallet::InitLoadWallet() (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x170E83: AppInitMain(boost::thread_group&, CScheduler&) (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x13E005: AppInit(int, char**) (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439==    by 0x13E6B6: main (in /home/joao/Projects/bitcoin/src/bitcoind)
    ==30439== 
    
    ==30439== HEAP SUMMARY:
    ==30439==     in use at exit: 2,384 bytes in 11 blocks
    ==30439==   total heap usage: 101,957 allocs, 101,946 frees, 69,306,991 bytes allocated
    ==30439== 
    ==30439== LEAK SUMMARY:
    ==30439==    definitely lost: 160 bytes in 1 blocks
    ==30439==    indirectly lost: 0 bytes in 0 blocks
    ==30439==      possibly lost: 0 bytes in 0 blocks
    ==30439==    still reachable: 2,224 bytes in 10 blocks
    ==30439==         suppressed: 0 bytes in 0 blocks
    ==30439== Rerun with --leak-check=full to see details of leaked memory
    ==30439== 
    ==30439== For counts of detected and suppressed errors, rerun with: -v
    ==30439== ERROR SUMMARY: 7 errors from 1 contexts (suppressed: 0 from 0)
    
  2. Fix uninitialized atomic variables 4652791141
  3. theuni commented at 11:02 PM on July 13, 2017: member

    utACK 4652791141f0a8a977b324147ccf1a2360b69ca4

  4. fanquake added the label Refactoring on Jul 13, 2017
  5. jonasschnelli commented at 8:15 AM on July 14, 2017: contributor

    Kicked travis (issue seems unrelated). utACK 4652791141f0a8a977b324147ccf1a2360b69ca4

  6. paveljanik commented at 10:06 AM on July 14, 2017: contributor

    utACK 4652791

  7. gmaxwell approved
  8. gmaxwell commented at 4:22 PM on July 14, 2017: contributor

    utACK

  9. TheBlueMatt commented at 9:08 PM on July 14, 2017: member

    utACK 4652791141f0a8a977b324147ccf1a2360b69ca4

  10. sipa merged this on Jul 14, 2017
  11. sipa closed this on Jul 14, 2017

  12. sipa referenced this in commit b7d6623c76 on Jul 14, 2017
  13. PastaPastaPasta referenced this in commit c71d4e8d0e on Jul 6, 2019
  14. PastaPastaPasta referenced this in commit 152932dbca on Jul 8, 2019
  15. PastaPastaPasta referenced this in commit a7590a971c on Jul 9, 2019
  16. PastaPastaPasta referenced this in commit 717ab5fe4a on Jul 11, 2019
  17. PastaPastaPasta referenced this in commit 24a02ca31e on Jul 13, 2019
  18. PastaPastaPasta referenced this in commit 21698d193e on Jul 17, 2019
  19. PastaPastaPasta referenced this in commit 284dcbd47a on Jul 17, 2019
  20. PastaPastaPasta referenced this in commit b14bd204ce on Jul 18, 2019
  21. barrystyle referenced this in commit 023ff55be4 on Jan 22, 2020
  22. DrahtBot locked this on Sep 8, 2021

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: 2026-04-22 00:15 UTC

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