Crash when creating wallet via bitcoin-cli #24810

issue tehelsper opened this issue on April 8, 2022
  1. tehelsper commented at 6:34 PM on April 8, 2022: none

    Description I expect to be able to create and load a wallet with Bitcoin CLI using the command "bitcoin-cli createwallet mywallet.dat" but it fails and Bitcoin Core crashes. The wallet appears to be partially created and the folder does exist.

    I also have that wallet listed as one to load via the config. The crash then causes bitcoin to restart via the systemd service and when it restarts it exits with an error indicating the wallet cannot be read.

    Expected Behavior I expected the wallet to be created. This works fine on Bitcoin Core 21.2, but fails on 22.0.

    Actual Behavior Bitcoin crashes and a corrupt wallet is made. This causes Bitcoin to reboot, attempt to read the new wallet, and exit again leading to a cyclic restart.

    Reliability I can reliably re-create it, but only on one device. On another very similar device, the issue is not present.

    Version v22.0 from the website.

    Device Info Debian, amd64.

    Linux mynode 4.19.0-20-amd64 #1 SMP Debian 4.19.235-1 (2022-03-17) x86_64 GNU/Linux

    GUI Not GUI related.

    CLI output when creating wallet

    admin@mynode:~$ bitcoin-cli createwallet break2
    error: timeout on transient error: Could not connect to the server 127.0.0.1:8332 (error code 1 - "EOF reached")
    
    Make sure the bitcoind server is running and that you are connecting to the correct RPC port.
    admin@mynode:~$ 
    

    Log when creating wallet (read bottom to top)

    ...
    2022-04-08T18:28:12Z Bitcoin Core version v22.0.0 (release build)
    
    <crash>
    
    2022-04-08T18:27:41Z BerkeleyEnvironment::Open: LogDir=/home/bitcoin/.bitcoin/break2/database ErrorFile=/home/bitcoin/.bitcoin/break2/db.log
    2022-04-08T18:27:41Z Using wallet /home/bitcoin/.bitcoin/break2/wallet.dat
    2022-04-08T18:27:41Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
    2022-04-08T18:27:41Z UpdateTip: new best=00000000000000000011ce88f1e73e85f7463f002b093b635e6fbdfb937937c5 height=552252 version=0x20000000 log2_work=90.084721 tx=361369223 date='2018-12-02T09:47:52Z' progress=0.507781 cache=622.6MiB(4620436txo)
    2022-04-08T18:27:41Z UpdateTip: new best=00000000000000000026cd6e6d1ffad655908877051cc7b7b778d7236ae64e14 height=552251 version=0x20c00000 log2_work=90.084690 tx=361366404 date='2018-12-02T09:25:26Z' progress=0.507777 cache=622.4MiB(4618903txo)
    
  2. tehelsper added the label Bug on Apr 8, 2022
  3. w0xlt commented at 6:49 PM on April 8, 2022: contributor

    It seems that there is no information in debug.log about the error. Can the error file /home/bitcoin/.bitcoin/break2/db.log have anything?

  4. tehelsper commented at 6:55 PM on April 8, 2022: none

    No, it's empty. Here are the contents of the wallet folder if it helps. The db.log file is empty and wallet.dat is missing.

    admin@mynode:~$ sudo ls -lsa /home/bitcoin/.bitcoin/break2/
    total 12
    4 drwx------ 3 bitcoin bitcoin 4096 Apr  8 13:27 .
    4 drwxr-xr-x 7 bitcoin bitcoin 4096 Apr  8 13:43 ..
    4 drwx------ 2 bitcoin bitcoin 4096 Apr  8 13:27 database
    0 -rw------- 1 bitcoin bitcoin    0 Apr  8 13:27 db.log
    0 -rw------- 1 bitcoin bitcoin    0 Apr  8 13:27 .walletlock
    admin@mynode:~$
    
  5. bitcoin deleted a comment on Apr 9, 2022
  6. jonatack commented at 10:42 PM on April 9, 2022: contributor

    @tehelsper Your issue reminded me of a similar one I am seeing -> #24816.

  7. nlightenme commented at 6:41 PM on May 28, 2022: none

    I'm having a similar issue on a fresh install of Ubuntu server 22.04. My 20.04 server works fine.

    On 22.04, the bitcoin-cli just sits there and does nothing for an eternity when you attempt to create a wallet. If you terminate the process, there's no wallet showing in the folder. There's nothing in debug.log relating to the failure.

  8. fanquake commented at 2:24 PM on August 8, 2022: member

    @tehelsper @nlightenme does this also happen with 23.0?

  9. maflcko added the label Wallet on Aug 10, 2022
  10. maflcko commented at 9:59 AM on August 10, 2022: member

    I can reliably re-create it, but only on one device. On another very similar device, the issue is not present.

    Did you reproduce on both devices the same way? Did you use self-compiled bdb? What are the exact steps to reproduce (ideally starting from a vanilla install of the OS)?

  11. tehelsper commented at 3:10 AM on August 13, 2022: none

    I can't seem to reproduce it with v23.0, but I am also using a new kernel now. Instead of failing, it can take a while for the command to complete, but it my no longer be an issue.

    admin@mynode:~$ time bitcoin-cli createwallet break1
    {
      "name": "break1",
      "warning": ""
    }
    
    real	0m44.675s
    user	0m0.003s
    sys	0m0.000s
    admin@mynode:~$ 
    

    New Kernel: Linux mynode 5.10.0-0.bpo.15-amd64 [#1](/bitcoin-bitcoin/1/) SMP Debian 5.10.120-1~bpo10+1 (2022-06-13) x86_64 GNU/Linux

    Basically, I started with vanilla Debian 10.11, downloaded Bitcoin core and started syncing. MyNode creates a couple wallets on setup that I had always been able to create as soon as the Bitcoin RPC was ready. Back in April, I was having some IBD issues and I had tracked it down to this issue.

    • Bitcoin Launched
    • IBD Started
    • Sync Froze (Bitcoin was restarting cyclically due to corrupt wallet)
    • Found corrupt wallet
    • Deleted wallet
    • Bitcoin started syncing again
    • Script found missing default wallet, RPC was up, make new wallet
    • Bitcoin crashed again
    • Bitcoin back in cyclic reboot due to re-launching with corrupt wallet
  12. achow101 commented at 11:08 PM on October 26, 2022: member

    Closing as it seems like this issue cannot be reproduced. Please leave a comment if this is still a problem and the issue should be reopened.

  13. achow101 closed this on Oct 26, 2022

  14. bitcoin locked this on Oct 26, 2023

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

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