bitcoin-qt crash after early call to loadwallet #16937

issue fanquake opened this issue on September 22, 2019
  1. fanquake commented at 11:59 PM on September 22, 2019: member

    A call to loadwallet while bitcoin-qt is starting will cause a crash:

    Process 77611 launched: '/Users/michael/github/bitcoin/src/qt/bitcoin-qt' (x86_64)
    2019-09-23 07:40:29.799378+0800 bitcoin-qt[77611:495185] MessageTracer: Falling back to default whitelist
    Process 77611 stopped
    * thread [#12](/bitcoin-bitcoin/12/), name = 'bitcoin-httpworker.0', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
        frame [#0](/bitcoin-bitcoin/0/): 0x00000001001faaa0 bitcoin-qt`WalletController::getOrCreateWallet(this=0x000000011a5a1670, wallet=unique_ptr<interfaces::Wallet, std::__1::default_delete<interfaces::Wallet> > @ 0x0000700009586200) at walletcontroller.cpp:96:36
       93  	
       94  	    // Return model instance if exists.
       95  	    if (!m_wallets.empty()) {
    -> 96  	        std::string name = wallet->getWalletName();
       97  	        for (WalletModel* wallet_model : m_wallets) {
       98  	            if (wallet_model->wallet().getWalletName() == name) {
       99  	                return wallet_model;
    Target 0: (bitcoin-qt) stopped.
    
    import argparse
    import time
    import os
    import sys
    
    from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
    
    # lldb src/qt/bitcoin-qt -- -debug -regtest
    # python3 crash.py <datadir>
    
    parser = argparse.ArgumentParser()
    parser.add_argument('datadir')
    args = parser.parse_args()
    
    cookie: str = args.datadir + '/regtest/.cookie'
    wallet_name: str = 'hello'
    
    # Wait for cookie file to be created
    while not os.path.exists(cookie):
        time.sleep(0.5)
    # Read .cookie file to get user and pass
    with open(cookie) as f:
        userpass: str = f.readline().lstrip().rstrip()
    rpc = AuthServiceProxy('http://{}@127.0.0.1:18443'.format(userpass))
    
    # Wait for bitcoin-qt to be ready
    ready: bool = False
    while not ready:
        print('waiting...')
        try:
            rpc.getblockchaininfo()
            ready = True
        except Exception:
            time.sleep(0.5)
            pass
    rpc.loadwallet(wallet_name)
    
  2. fanquake added the label GUI on Sep 22, 2019
  3. fanquake added the label good first issue on Sep 22, 2019
  4. icota referenced this in commit db31bcb475 on Sep 24, 2019
  5. promag commented at 7:53 AM on September 25, 2019: member

    Are you able to crash in every try?

  6. laanwj closed this on Jan 8, 2020

  7. sidhujag referenced this in commit a46d74a339 on Jan 8, 2020
  8. sidhujag referenced this in commit fc6d53ddd2 on Nov 10, 2020
  9. DrahtBot locked this on Feb 15, 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: 2026-05-02 15:14 UTC

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