test: unbreak: exclude windows from wallet_assumeutxo #29238

pull jamesob wants to merge 1 commits into bitcoin:master from jamesob:2024-01-au-wallet-fix changing 1 files +3 −0
  1. jamesob commented at 9:29 PM on January 11, 2024: contributor

    Basic fix for the CI failure introduced in #28838 until something better can be devised.

    Apparently Windows doesn't allow two processes to read the same wallet file. Note that this failure is unique to the tests and not something an end user would see (unless they were running two bitcoind instances...).

  2. DrahtBot commented at 9:29 PM on January 11, 2024: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK achow101
    Stale ACK BrandonOdiwuor

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. DrahtBot added the label Tests on Jan 11, 2024
  4. maflcko approved
  5. maflcko commented at 7:21 AM on January 12, 2024: member

    lgtm, but wouldn't it be better to just unload the wallet for a short time?

  6. jamesob force-pushed on Jan 12, 2024
  7. in test/functional/wallet_assumeutxo.py:134 in 594f39480f outdated
     129 | @@ -124,8 +130,14 @@ def run_test(self):
     130 |          assert_equal(n1.getblockchaininfo()["blocks"], SNAPSHOT_BASE_HEIGHT)
     131 |  
     132 |          self.log.info("Backup can't be loaded during background sync")
     133 | +        if is_windows:
     134 | +            n0.unloadwallet('w')
    


    maflcko commented at 2:31 PM on January 12, 2024:
            n0.unloadwallet('w')   # Required, because on Windows only one process can access a file, when it is written
    

    nit: Seems better to run the same test on all platforms, than to run different branches on different platforms, and thus make it harder to debug test failures?

  8. maflcko approved
  9. jamesob force-pushed on Jan 12, 2024
  10. maflcko commented at 2:56 PM on January 12, 2024: member
    test/functional/wallet_assumeutxo.py:14:1: F401 'platform' imported but unused
    
  11. DrahtBot added the label CI failed on Jan 12, 2024
  12. BrandonOdiwuor approved
  13. BrandonOdiwuor commented at 4:20 PM on January 12, 2024: contributor

    Code Review ACK 99399ae88fa23c0333bc2b0d59b48d0936a869c7

  14. m3dwards commented at 4:44 PM on January 12, 2024: contributor

    I'm struggling to exactly replicate this locally. I get a failure and on the same line but my error seems to be the assert failing that expects an exception:

    2024-01-12T16:34:39.449000Z TestFramework (INFO): Backup can't be loaded during background sync
    2024-01-12T16:34:39.496000Z TestFramework (ERROR): Assertion failed
    Traceback (most recent call last):
      File "C:\Users\Max\source\bitcoin\test\functional\test_framework\util.py", line 140, in try_rpc
        fun(*args, **kwds)
      File "C:\Users\Max\source\bitcoin\test\functional\test_framework\coverage.py", line 50, in __call__
        return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Max\source\bitcoin\test\functional\test_framework\authproxy.py", line 129, in __call__
        raise JSONRPCException(response['error'], status)
    test_framework.authproxy.JSONRPCException: remove_all: unknown error: "C:\Users\Max\AppData\Local\Temp\bitcoin_func_test_bud5txts\node1\regtest\w" (-1)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:\Users\Max\source\bitcoin\test\functional\test_framework\test_framework.py", line 131, in main
        self.run_test()
      File "C:\Users\Max\source\bitcoin\test\functional\wallet_assumeutxo.py", line 134, in run_test
        assert_raises_rpc_error(-4, "Wallet loading failed. Error loading wallet. Wallet requires blocks to be downloaded, and software does not currently support loading wallets while blocks are being downloaded out of order when using assumeutxo snapshots. Wallet should be able to load successfully after node sync reaches height 299", n1.restorewallet, "w", "backup_w.dat")
      File "C:\Users\Max\source\bitcoin\test\functional\test_framework\util.py", line 131, in assert_raises_rpc_error
        assert try_rpc(code, message, fun, *args, **kwds), "No exception raised"
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Max\source\bitcoin\test\functional\test_framework\util.py", line 144, in try_rpc
        raise AssertionError("Unexpected JSONRPC error code %i" % e.error["code"])
    AssertionError: Unexpected JSONRPC error code -1
    2024-01-12T16:34:39.552000Z TestFramework (INFO): Stopping nodes
    

    I tried the changes in 99399ae88fa23c0333bc2b0d59b48d0936a869c7 but they didn't help my local failure. If I remove the assert_raises_rpc_error(-4, "Wallet loading failed... assertion the test passes for me locally.

    edit: it could be that I'm getting the same problem but for whatever reason the reason is "unknown error" for me.

  15. achow101 commented at 4:56 PM on January 12, 2024: member

    I don't think this fixes the problem.

  16. jamesob force-pushed on Jan 12, 2024
  17. jamesob force-pushed on Jan 12, 2024
  18. jamesob commented at 5:56 PM on January 12, 2024: contributor

    I've reverted to the dumb fix that will unbreak CI (but still add @Sjors' useful coverage for non-Windows platforms). If anyone can come up with something smarter that actually works, I'll be happy to review.

  19. Sjors commented at 6:16 PM on January 12, 2024: member

    Left an alternative suggestion here that (hopefully) doesn't require an exception for Windows: https://github.com/bitcoin/bitcoin/pull/28838/files#r1450778587

  20. jamesob commented at 6:24 PM on January 12, 2024: contributor

    Left an alternative suggestion here that (hopefully) doesn't require an exception for Windows: https://github.com/bitcoin/bitcoin/pull/28838/files#r1450778587

    Sadly (per the thread), not so simple. I think we should probably unbreak and then reassess but I'll leave that as a call for the maintainers.

  21. Sjors commented at 6:25 PM on January 12, 2024: member

    Skipping Windows for now is fine by me. Best just leave #29234 open until it's more properly solved.

  22. in test/functional/wallet_assumeutxo.py:60 in 3a107a5bfd outdated
      53 | @@ -52,6 +54,11 @@ def run_test(self):
      54 |          Load the snapshot into the second, ensure it syncs to tip and completes
      55 |          background validation when connected to the first.
      56 |          """
      57 | +        # Disable this test for windows currently because it doesn't allow two
      58 | +        # bitcoind processes simultaneously trying to read the same wallet file.
      59 | +        if platform.system() == "Windows":
      60 | +            return
    


    achow101 commented at 6:29 PM on January 12, 2024:

    I think it would be better if we used skip_test_if_missing_module so that the test is reported as skipped instead of silently "passing" on windows. Could also use skip_if_platform_not_posix for that.


    jamesob commented at 6:31 PM on January 12, 2024:

    Oh, good call. Will do.

  23. jamesob force-pushed on Jan 12, 2024
  24. test: unbreak: exclude windows from wallet_assumeutxo f6140e4773
  25. m3dwards commented at 6:34 PM on January 12, 2024: contributor

    I agree with @achow101 that there looks like there is a problem with the cleanup when the wallet restore fails.

    As a quick fix, what about just removing line 127 which calls assert_raises_rpc_error. It's intended to fail and cleanup anyway and so shouldn't affect the rest of the test.

    Test passes locally for me on windows without this line.

  26. achow101 commented at 6:36 PM on January 12, 2024: member

    ACK f6140e47736a1b105196ba91080c7c1d203f2a77

    As a quick fix, what about just removing line 127 which calls assert_raises_rpc_error. It's intended to fail and cleanup anyway and so shouldn't affect the rest of the test.

    That failure is an important part of the test since we need to be testing that wallets don't load while background ibd is ongoing.

  27. DrahtBot requested review from BrandonOdiwuor on Jan 12, 2024
  28. Sjors commented at 6:37 PM on January 12, 2024: member

    As a quick fix, what about just removing line 127 which calls assert_raises_rpc_error.

    That would make the test worse on all platforms. The point of that assert_raises_rpc_error is to prevent a regression where we allow the user to restore a wallet too early in the IBD process. That's probably not a rare occurrence: get new computer, start Bitcoin Core, load snapshot, load wallet backup -> oops.

  29. DrahtBot removed review request from BrandonOdiwuor on Jan 12, 2024
  30. DrahtBot requested review from BrandonOdiwuor on Jan 12, 2024
  31. m3dwards commented at 6:39 PM on January 12, 2024: contributor

    That failure is an important part of the test since we need to be testing that wallets don't load while background ibd is ongoing.

    Understood, was thinking just as a temporary measure until the remove_all call was fixed on windows. Perhaps just disable that line on windows then.

  32. DrahtBot removed review request from BrandonOdiwuor on Jan 12, 2024
  33. DrahtBot requested review from BrandonOdiwuor on Jan 12, 2024
  34. DrahtBot removed the label CI failed on Jan 12, 2024
  35. achow101 commented at 1:14 AM on January 13, 2024: member

    I believe I've found the root cause of the test failure, fix in #29243

  36. DrahtBot removed review request from BrandonOdiwuor on Jan 13, 2024
  37. DrahtBot requested review from BrandonOdiwuor on Jan 13, 2024
  38. jamesob commented at 3:41 AM on January 13, 2024: contributor

    Closing in favor of #29243.

  39. jamesob closed this on Jan 13, 2024

  40. bitcoin locked this on Jan 12, 2025

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-25 21:13 UTC

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