test: Fix segfault in the psbt_wallet_tests/psbt_updater_test #23403

pull hebasto wants to merge 2 commits into bitcoin:master from hebasto:210331-psbt changing 3 files +10 −1
  1. hebasto commented at 11:59 am on October 31, 2021: member

    The dcd6eeb64adb2b532f5003cbb86ba65b3c08a87b commit (bitcoin/bitcoin#23288) introduced an intermittent failure in the psbt_wallet_tests/psbt_updater_test unit test. See bitcoin/bitcoin#23368.

    The test failure can be easily made reproducible with the following patch:

     0--- a/src/scheduler.cpp
     1+++ b/src/scheduler.cpp
     2@@ -57,6 +57,8 @@ void CScheduler::serviceQueue()
     3             Function f = taskQueue.begin()->second;
     4             taskQueue.erase(taskQueue.begin());
     5 
     6+            UninterruptibleSleep(100ms);
     7+
     8             {
     9                 // Unlock before calling f, so it can reschedule itself or another task
    10                 // without deadlocking:
    

    This PR implements an idea which was mentioned in the comment:

    Yes, as I said before this looks like a race where the wallet is deleted before stopping the scheduler: #23368 (comment)

    IIRC, the order should be:

    • stop scheduler

    • delete wallet

    • delete scheduler

    The second commit introduces a refactoring with no behavior change.

    Fixes bitcoin/bitcoin#23368.

  2. test: Fix segfault in the psbt_wallet_tests/psbt_updater_test
    The bug was introduced in dcd6eeb64adb2b532f5003cbb86ba65b3c08a87b.
    7986faf2e0
  3. test: Avoid excessive locking of `cs_wallet` 68018e4c3e
  4. hebasto added the label Wallet on Oct 31, 2021
  5. hebasto added the label Tests on Oct 31, 2021
  6. mjdietzx commented at 9:15 pm on October 31, 2021: contributor
    Code review ACK 68018e4c3e76f7e5bebf5f90ffd972c7bf01e0a0
  7. MarcoFalke merged this on Nov 1, 2021
  8. MarcoFalke closed this on Nov 1, 2021

  9. hebasto deleted the branch on Nov 1, 2021
  10. sidhujag referenced this in commit 0e193a7268 on Nov 1, 2021
  11. MarcoFalke referenced this in commit b4f647fa36 on Nov 29, 2021
  12. sidhujag referenced this in commit 537b8a836d on Nov 29, 2021
  13. Fabcien referenced this in commit f74630fe32 on Jan 25, 2022
  14. PastaPastaPasta referenced this in commit c8374bd577 on Apr 7, 2022
  15. PastaPastaPasta referenced this in commit 25f8e062c0 on Apr 7, 2022
  16. PastaPastaPasta referenced this in commit 572737fff5 on Apr 7, 2022
  17. PastaPastaPasta referenced this in commit 22838d1b8c on Apr 11, 2022
  18. DrahtBot locked this on Nov 2, 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-11-22 12:12 UTC

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