intermittent issue in wallet_backwards_compatibility (BerkeleyEnvironment::Open: Error -30974 opening database environment: DB_RUNRECOVERY: Fatal error, run database recovery) #26869

issue maflcko opened this issue on January 11, 2023
  1. maflcko commented at 8:11 AM on January 11, 2023: member
    $ wget https://drahtbot.space/temp_scratch/wallet_backwards_compatibility_113.tar.xz
    $ tar xvf wallet_backwards_compatibility_113.tar.xz
    $ ./test/functional/combine_logs.py -c ./wallet_backwards_compatibility_113 | tail -525 | head -13
     node2 2023-01-11T00:21:39.903849Z [httpworker.2] [wallet/bdb.cpp:145] [Open] BerkeleyEnvironment::Open: LogDir=/root/bitcoin-core/ci/scratch/test_runner/test_runner_₿_šŸƒ_20230111_000842/wallet_backwards_compatibility_113/node2/regtest/wallets/w1/database ErrorFile=/root/bitcoin-core/ci/scratch/test_runner/test_runner_₿_šŸƒ_20230111_000842/wallet_backwards_compatibility_113/node2/regtest/wallets/w1/db.log 
     node2 2023-01-11T00:21:39.906405Z [httpworker.2] [wallet/bdb.cpp:172] [Open] BerkeleyEnvironment::Open: Error -30974 opening database environment: DB_RUNRECOVERY: Fatal error, run database recovery 
     test  2023-01-11T00:21:39.909000Z TestFramework (ERROR): JSONRPC error 
                                       Traceback (most recent call last):
                                         File "/root/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 134, in main
                                           self.run_test()
                                         File "/root/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/wallet_backwards_compatibility.py", line 185, in run_test
                                           node.loadwallet(wallet_name)
                                         File "/root/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/coverage.py", line 49, in __call__
                                           return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
                                         File "/root/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/authproxy.py", line 146, in __call__
                                           raise JSONRPCException(response['error'], status)
                                       test_framework.authproxy.JSONRPCException: Wallet file verification failed. Error initializing wallet database environment "/root/bitcoin-core/ci/scratch/test_runner/test_runner_₿_šŸƒ_20230111_000842/wallet_backwards_compatibility_113/node2/regtest/wallets/w1"! This error could occur if this wallet was not shutdown cleanly and was last loaded using a build with a newer version of Berkeley DB. If so, please use the software that last loaded this wallet (-4)
    
  2. maflcko added the label Bug on Jan 11, 2023
  3. maflcko commented at 8:26 AM on January 11, 2023: member

    (Happened in the asan ci task, if relevant)

  4. john-moffett commented at 7:33 PM on January 11, 2023: contributor

    Contents of db.log from the w1 wallet in node2:

    Unacceptable log file /root/bitcoin-core/ci/scratch/test_runner/test_runner_₿_šŸƒ_20230111_000842/wallet_backwards_compatibility_113/node2/regtest/wallets/w1/database/log.0000000001: unsupported log version 19
    Invalid log file: log.0000000001: Invalid argument
    PANIC: Invalid argument
    process-private: unable to find environment
    

    Same error from this comment, which seemed to be a genuine incompatibility issue.

    Edit: It looks like asan uses --with-incompatible-bdb. Could that be the problem? I'd imagine it wouldn't be intermittent, though.

  5. maflcko commented at 10:18 PM on January 11, 2023: member

    I wonder why there are any logs, given that the wallet was unloaded before

  6. maflcko added the label Tests on Jan 11, 2023
  7. maflcko added the label Wallet on Jan 11, 2023
  8. john-moffett commented at 11:25 PM on January 11, 2023: contributor

    Hmm, good point. I’d also assumed that unloading the wallet would remove the log.0000000001 file, but maybe that only happens on shutdown?

  9. maflcko commented at 9:11 AM on January 12, 2023: member

    So the bug either is that unloadwallet doesn't flush or that the test assumes it does? cc @Sjors

  10. Sjors commented at 11:54 AM on January 12, 2023: member

    I don't think the purpose of our backwards compatibility test is to find every conceivable way in which a wallet is uncleanly closed. So I would be fine with having the test wipe log files - or do a complete node shutdown instead of merely unloading - if it prevents intermittent failures.

  11. john-moffett commented at 7:32 PM on January 13, 2023: contributor

    It seems like DB_LOG_AUTO_REMOVE is the source of the non-determinism since there aren't guarantees when it'll run.

    Maybe the best solution is to skip copying the wallet database directory when copying the wallets to the old nodes?

    Something like:

    for node in legacy_nodes:
        # Copy wallets to previous version
        for wallet in os.listdir(node_master_wallets_dir):
            shutil.copytree(
                os.path.join(node_master_wallets_dir, wallet),
                os.path.join(self.nodes_wallet_dir(node), wallet),
                # Do not copy the database log files
                ignore=shutil.ignore_patterns("database")
            )
    
  12. maflcko commented at 3:35 PM on February 7, 2023: member

    Discussion: #26915 (comment)

  13. maflcko commented at 10:21 AM on February 8, 2023: member

    Looks like this is a CI system bug, which will be fixed in https://github.com/bitcoin/bitcoin/pull/27033

  14. maflcko closed this on Feb 8, 2023

  15. bitcoin locked this on Feb 8, 2024

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-15 00:13 UTC

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