Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Blocks only communication #3

Merged
merged 8 commits into from Aug 13, 2016
Merged

Blocks only communication #3

merged 8 commits into from Aug 13, 2016

Conversation

StakeBox
Copy link

No description provided.

@StakeBox StakeBox merged commit 7fd2bfc into master Aug 13, 2016
@Mrs-X Mrs-X deleted the blocks-only branch January 8, 2017 11:11
random-zebra added a commit that referenced this pull request Mar 18, 2020
…sRow

359f70e [GUI] Explicit cast from quint32 to bool in filterAcceptsRow (random-zebra)

Pull request description:

  This is a (hopefully definitive) fix for a strange segfault I was consistently having on testnet with the GUI wallet (during the loading of the stake charts), with the following stacktrace
  ```
  #0  0x00007ffff58363bb in  ()
      at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
  #1  0x00007ffff583b25d in  ()
      at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
  #2  0x00007ffff583b932 in  ()
      at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
  #3  0x00007ffff583bca9 in  ()
      at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
  #4  0x00007ffff583c50a in QSortFilterProxyModel::invalidateFilter() ()
      at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
  #5  0x00005555556aa809 in DashboardWidget::updateStakeFilter() (this=this@entry=0x5555577817d0) at qt/pivx/dashboardwidget.cpp:480
  #6  0x00005555556ac736 in DashboardWidget::getAmountBy() (this=this@entry=0x5555577817d0) at qt/pivx/dashboardwidget.cpp:503
  #7  0x00005555556ad1a1 in DashboardWidget::loadChartData(bool) (this=this@entry=0x5555577817d0, withMonthNames=false)
      at qt/pivx/dashboardwidget.cpp:556
  #8  0x00005555556ad703 in DashboardWidget::run(int) (this=0x5555577817d0, type=<optimized out>) at qt/pivx/dashboardwidget.cpp:812
  #9  0x00005555557641d4 in Worker::process() (this=0x5555576314c0)
      at qt/pivx/loadingdialog.cpp:12
  #10 0x00007ffff56932b2 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
  #11 0x00007ffff569617d in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
  #12 0x00007ffff4ae36db in start_thread (arg=0x7ffe61ffb700) at pthread_create.c:463
  #13 0x00007ffff2c9e88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  ```

  Explicit the cast to bool when checking the transaction type in `TransactionFilterProxy::filterAcceptsRow`.

ACKs for top commit:
  furszy:
    detective work 👍 , utACK 359f70e.
  Fuzzbawls:
    utACK 359f70e then

Tree-SHA512: f1481a0545fb1ebe62b28232f9257e6c52306ff15dd1dcefc29d4eeb3dd25b7231d48416cad528e720fb68aa192b089e14bfc8ee92e55406ea02fc777f552b15
Gh0st-N1njA pushed a commit to Gh0st-N1njA/PactumCoin that referenced this pull request May 14, 2020
Fuzzbawls added a commit to Fuzzbawls/PIVX that referenced this pull request Sep 23, 2020
98261b1 Merge PIVX-Project#22: Clamp JSON object depth to PHP limit
54c4015 Clamp JSON object depth to PHP limit
5a58a46 Merge PIVX-Project#21: Remove hand-coded UniValue destructor.
b4cdfc4 Remove hand-coded UniValue destructor.
7fba60b Merge PIVX-Project#17: [docs] Update readme
4577454 Merge PIVX-Project#13: Fix typo
ac7e73c [docs] Update readme
7890db9 Merge PIVX-Project#11: Remove deprecated std pair wrappers
40e3485 Merge PIVX-Project#14: Cleaned up namespace imports to reduce symbol collisions
4a49647 Fix typo
85052a4 Remove deprecated std::pair wrappers
51d3ab3 Merge PIVX-Project#10: Add pushKV(key, boolean) function (replaces PIVX-Project#5)
129bad9 [tests] test pushKV for boolean values
b3c44c9 Pushing boolean value to univalue correctly
07947ff Merge PIVX-Project#9: [tests] Fix BOOST_CHECK_THROW macro
ec849d9 [tests] Fix BOOST_CHECK_THROW macro
d208f98 Cleaned up namespace imports to reduce symbol collisions
31bc9f5 Merge PIVX-Project#8: Remove unused Homebrew workaround
fa04209 Remove HomeBrew workaround
a523e08 Merge PIVX-Project#7: Declare single-argument (non-converting) constructors "explicit"
a9e53b3 Merge PIVX-Project#4: Pull upstream
fe805ea Declare single-argument (non-converting) constructors "explicit"
8a2d6f1 Merge pull request PIVX-Project#41 from jgarzik/get-obj-map
ba341a2 Add getObjMap() helper method.  Also, constify checkObject().
ceb1194 Handle .pushKV() and .checkObject() edge cases.
107db98 Add ::push_back(double) method for feature parity.
d415300 Move one-line implementation of UniValue::read() to header.
52e85b3 Move exception-throwing get_* methods into separate implementation module.
16a1f7f Merge PIVX-Project#3: Pull upstream
daf1285 Merge pull request PIVX-Project#2 from jgarzik/master
f32df99 Merge branch '2016_04_unicode' into bitcoin
280b191 Merge remote-tracking branch 'jgarzik/master' into bitcoin
2740c4f Merge branch '2015_11_escape_plan' into bitcoin

git-subtree-dir: src/univalue
git-subtree-split: 98261b1
Fuzzbawls added a commit to Fuzzbawls/PIVX that referenced this pull request Sep 24, 2020
98261b1 Merge PIVX-Project#22: Clamp JSON object depth to PHP limit
54c4015 Clamp JSON object depth to PHP limit
5a58a46 Merge PIVX-Project#21: Remove hand-coded UniValue destructor.
b4cdfc4 Remove hand-coded UniValue destructor.
7fba60b Merge PIVX-Project#17: [docs] Update readme
4577454 Merge PIVX-Project#13: Fix typo
ac7e73c [docs] Update readme
7890db9 Merge PIVX-Project#11: Remove deprecated std pair wrappers
40e3485 Merge PIVX-Project#14: Cleaned up namespace imports to reduce symbol collisions
4a49647 Fix typo
85052a4 Remove deprecated std::pair wrappers
51d3ab3 Merge PIVX-Project#10: Add pushKV(key, boolean) function (replaces PIVX-Project#5)
129bad9 [tests] test pushKV for boolean values
b3c44c9 Pushing boolean value to univalue correctly
07947ff Merge PIVX-Project#9: [tests] Fix BOOST_CHECK_THROW macro
ec849d9 [tests] Fix BOOST_CHECK_THROW macro
d208f98 Cleaned up namespace imports to reduce symbol collisions
31bc9f5 Merge PIVX-Project#8: Remove unused Homebrew workaround
fa04209 Remove HomeBrew workaround
a523e08 Merge PIVX-Project#7: Declare single-argument (non-converting) constructors "explicit"
a9e53b3 Merge PIVX-Project#4: Pull upstream
fe805ea Declare single-argument (non-converting) constructors "explicit"
8a2d6f1 Merge pull request PIVX-Project#41 from jgarzik/get-obj-map
ba341a2 Add getObjMap() helper method.  Also, constify checkObject().
ceb1194 Handle .pushKV() and .checkObject() edge cases.
107db98 Add ::push_back(double) method for feature parity.
d415300 Move one-line implementation of UniValue::read() to header.
52e85b3 Move exception-throwing get_* methods into separate implementation module.
16a1f7f Merge PIVX-Project#3: Pull upstream
daf1285 Merge pull request PIVX-Project#2 from jgarzik/master
f32df99 Merge branch '2016_04_unicode' into bitcoin
280b191 Merge remote-tracking branch 'jgarzik/master' into bitcoin
2740c4f Merge branch '2015_11_escape_plan' into bitcoin

git-subtree-dir: src/univalue
git-subtree-split: 98261b1
furszy added a commit that referenced this pull request Mar 3, 2021
4749d52 [Refactoring][BUG] Unchecked LoadGenesisBlock return value (random-zebra)
43cc880 Fix segfault when shutting down before fully loading (Matt Corallo)
5f1f014 Order chainstate init more logically. (random-zebra)
9b87537 More user-friendly error message if UTXO DB runs ahead of block DB (Matt Corallo)
9bcc942 Fix some LoadChainTip-related init-order bugs. (random-zebra)

Pull request description:

  Had this segfault when trying to shut down the wallet before the coins cache is loaded.
  ```
  CCoinsViewCache::DynamicMemoryUsage (this=0x0) at coins.cpp:60
  60	    return memusage::DynamicUsage(cacheCoins) +
  (gdb) bt
  #0  0x0000555555bb8b44 in CCoinsViewCache::DynamicMemoryUsage() const (this=0x0) at coins.cpp:60
  #1  0x0000555555996bc1 in FlushStateToDisk(CValidationState&, FlushStateMode) (state=..., mode=mode@entry=FLUSH_STATE_ALWAYS) at validation.cpp:1730
  #2  0x0000555555997540 in FlushStateToDisk() () at validation.cpp:1806
  #3  0x000055555582516c in PrepareShutdown() () at init.cpp:266
  #4  0x0000555555826005 in Shutdown() () at init.cpp:339
  ```

  This is due to a bug introduced in 64c525b (we should null-check `pcoinsTip` before calling `FlushStateToDisk` at line 266, same as we do at line 283).

  Upstream fixed it in bitcoin#10758 among few other things.
  Backported here without ff3a219 (as we don't have `RewindBlockIndex` or `reindex-chainstate` yet).

ACKs for top commit:
  Fuzzbawls:
    ACK 4749d52
  furszy:
    ACK 4749d52 and merging..

Tree-SHA512: 23f27c4a9422a72794054698313259f89ad22a58dba2809901653e08c964c73e4eaeab872ada42380e76eb46ddd7e57f08b65f22812c791d0c2b274e5f0202a7
Fuzzbawls added a commit that referenced this pull request Apr 20, 2024
f9a6ebd fix: solve data race by making nTimeBestReceived atomic (ale)
4331c30 refactor: move nTimeBestReceived to CWallet (ale)

Pull request description:

  First commit is a small refactor:  the global variable `nTimeBestReceived` is now a private member of the `CWallet` class, as it was used only there.

  Second commit: fix the following data race by making `nTimeBestReceived` atomic

  ```
  WARNING: ThreadSanitizer: data race (pid=18270)
    Write of size 8 at 0x7b6800000ed8 by thread T16:
      #0 CWallet::UpdatedBlockTip(CBlockIndex const*, CBlockIndex const*, bool) wallet/wallet.cpp:2094 (pivxd+0x5058c9)
      #1 void std::__invoke_impl<void, void (CValidationInterface::*&)(CBlockIndex const*, CBlockIndex const*, bool), CValidationInterface*&, CBlockIndex const*, CBlockIndex const*, bool>(std::__invoke_memfun_deref, void (CValidationInterface::*&)(CBlockIndex const*, CBlockIndex const*, bool), CValidationInterface*&, CBlockIndex const*&&, CBlockIndex const*&&, bool&&) /usr/include/c++/12/bits/invoke.h:74 (pivxd+0x2ee1c0)
      #2 std::__invoke_result<void (CValidationInterface::*&)(CBlockIndex const*, CBlockIndex const*, bool), CValidationInterface*&, CBlockIndex const*, CBlockIndex const*, bool>::type std::__invoke<void (CValidationInterface::*&)(CBlockIndex const*, CBlockIndex const*, bool), CValidationInterface*&, CBlockIndex const*, CBlockIndex const*, bool>(void (CValidationInterface::*&)(CBlockIndex const*, CBlockIndex const*, bool), CValidationInterface*&, CBlockIndex const*&&, CBlockIndex const*&&, bool&&) /usr/include/c++/12/bits/invoke.h:96 (pivxd+0x2ee25a)
      #3 void std::_Bind<void (CValidationInterface::*(CValidationInterface*, std::_Placeholder<1>, std::_Placeholder<2>, std::_Placeholder<3>))(CBlockIndex const*, CBlockIndex const*, bool)>::__call<void, CBlockIndex const*&&, CBlockIndex const*&&, bool&&, 0ul, 1ul, 2ul, 3ul>(std::tuple<CBlockIndex const*&&, CBlockIndex const*&&, bool&&>&&, std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) /usr/include/c++/12/functional:484 (pivxd+0x2ee25a)
      ...

    Previous read of size 8 at 0x7b6800000ed8 by thread T35 (mutexes: write M134298, write M132880):
      #0 CWallet::ResendWalletTransactions(CConnman*) wallet/wallet.cpp:2065 (pivxd+0x515b25)
      #1 void std::__invoke_impl<void, void (CValidationInterface::*&)(CConnman*), CValidationInterface*&, CConnman*>(std::__invoke_memfun_deref, void (CValidationInterface::*&)(CConnman*), CValidationInterface*&, CConnman*&&) /usr/include/c++/12/bits/invoke.h:74 (pivxd+0x2eef45)
      #2 std::__invoke_result<void (CValidationInterface::*&)(CConnman*), CValidationInterface*&, CConnman*>::type std::__invoke<void (CValidationInterface::*&)(CConnman*), CValidationInterface*&, CConnman*>(void (CValidationInterface::*&)(CConnman*), CValidationInterface*&, CConnman*&&) /usr/include/c++/12/bits/invoke.h:96 (pivxd+0x2eefb9)
      #3 void std::_Bind<void (CValidationInterface::*(CValidationInterface*, std::_Placeholder<1>))(CConnman*)>::__call<void, CConnman*&&, 0ul, 1ul>(std::tuple<CConnman*&&>&&, std::_Index_tuple<0ul, 1ul>) /usr/include/c++/12/functional:484 (pivxd+0x2eefb9)
      ...
  ```

ACKs for top commit: f9a6ebd
  Duddino:
    utACK f9a6ebd
  Liquid369:
    tACK f9a6ebd
  Fuzzbawls:
    ACK f9a6ebd

Tree-SHA512: c1de883956bf0958204b05c338831c27f694e6453e74b77e3347ae12a3cbd69df2fe1120bae3fca72dab14587c0c499c4f92d5c53943305855e66fc1275ab4fa
Fuzzbawls added a commit that referenced this pull request Apr 20, 2024
ddbd4b0 fix BlockStateCatcher data races (ale)
b01c3df let validationinterface take shared_ptr (ale)

Pull request description:

  first commit:
  Partially backport bitcoin PR bitcoin#18338 which introduce the functions
  `RegisterSharedValidationInterface` and `UnregisterSharedValidationInterface`.  See that PR why using normal pointers is problematic, and how `shared_ptr` solve the issue
  (In a few words the problem is that it can happen that the pointed memory is freed before all signals have been processed, while with shared pointer we are sure that  memory will be freed after the last signal is handled)

  second commit:
  Utilize the new functions to the validation interface `BlockStateCatcher`.  In order to keep everywhere the logic unchanged (Registering on creation and Unregistering when the object goes out of scope) I created the wrapper class `BlockStateCatcherWrapper` which contains a `shared_ptr` to `BlockStatecatcher`.

  Those two commits solve the following data race where a `BlockStateCatcher` pointer is dereferenced after the pointed memory is freed

  ```
  WARNING: ThreadSanitizer: data race on vptr (ctor/dtor vs virtual call) (pid=6423)
    Write of size 8 at 0x7fc3d7c2d570 by thread T20:
      #0 CValidationInterface::~CValidationInterface() validationinterface.h:75 (pivxd+0xeacac)
      #1 BlockStateCatcher::~BlockStateCatcher() util/blockstatecatcher.h:23 (pivxd+0xeacac)
      #2 generateBlocks(Consensus::Params const&, CWallet*, bool, int, int, int, CScript*) rpc/mining.cpp:78 (pivxd+0x1c1a98)
      #3 generate(JSONRPCRequest const&) rpc/mining.cpp:140 (pivxd+0x1c2215)
      ...

    Previous read of size 8 at 0x7fc3d7c2d570 by thread T35 (mutexes: write M133270, write M132847):
      #0 void std::__invoke_impl<void, void (CValidationInterface::*&)(CConnman*), CValidationInterface*&, CConnman*>(std::__invoke_memfun_deref, void (CValidationInterface::*&)(CConnman*), CValidationInterface*&, CConnman*&&) /usr/include/c++/12/bits/invoke.h:74 (pivxd+0x2eef14)
      #1 std::__invoke_result<void (CValidationInterface::*&)(CConnman*), CValidationInterface*&, CConnman*>::type std::__invoke<void (CValidationInterface::*&)(CConnman*), CValidationInterface*&, CConnman*>(void (CValidationInterface::*&)(CConnman*), CValidationInterface*&, CConnman*&&) /usr/include/c++/12/bits/invoke.h:96 (pivxd+0x2eefbb)
      #2 void std::_Bind<void (CValidationInterface::*(CValidationInterface*, std::_Placeholder<1>))(CConnman*)>::__call<void, CConnman*&&, 0ul, 1ul>(std::tuple<CConnman*&&>&&, std::_Index_tuple<0ul, 1ul>) /usr/include/c++/12/functional:484 (pivxd+0x2eefbb)
      ...
     ```

ACKs for top commit: ddbd4b0
  Duddino:
    utACK ddbd4b0
  Liquid369:
    tACK ddbd4b0

Tree-SHA512: 94d55effc11f14f755f27c30ef1b6801a235bc314cc34312ebb14b75525824d3b11bb7812389d9977c30a0929d62fb745bd5c1a15249708014bd573132a5e55c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants