bitcoin-qt crashes if it can’t listen on the port it wants to #26340

issue dooglus openend this issue on October 19, 2022
  1. dooglus commented at 5:29 pm on October 19, 2022: contributor

    I created new folders ~/.bitcoin2 and ~/.bitcoin3, then ran bitcoin-qt using both of them as data directories.

    The first one ran fine:

    qt/bitcoin-qt -datadir=/home/chris/.bitcoin2
    

    I left the first one running. The second one crashed in various ways:

    $ qt/bitcoin-qt -datadir=/home/chris/.bitcoin3
    Error: Unable to bind to 0.0.0.0:8333 on this computer. Bitcoin Core is probably already running.
    Error: Failed to listen on any port. Use -listen=0 if you want this.
    Segmentation fault
    
    $ qt/bitcoin-qt -datadir=/home/chris/.bitcoin3
    Error: Unable to bind to 0.0.0.0:8333 on this computer. Bitcoin Core is probably already running.
    Error: Failed to listen on any port. Use -listen=0 if you want this.
    free(): double free detected in tcache 2
    Aborted
    
    $ qt/bitcoin-qt -datadir=/home/chris/.bitcoin3
    Error: Unable to bind to 0.0.0.0:8333 on this computer. Bitcoin Core is probably already running.
    Error: Failed to listen on any port. Use -listen=0 if you want this.
    corrupted size vs. prev_size in fastbins
    Aborted
    

    I would expect it to complain about the unavailable port, but not to crash in such random ways.

    This is bitcoin built against git tag v24.0rc2.

  2. dooglus added the label Bug on Oct 19, 2022
  3. maflcko added the label GUI on Oct 19, 2022
  4. jarolrod commented at 5:06 am on October 20, 2022: member

    Bitcoin should not run because we can’t bind on said port and so the GUI isn’t going to run. But, the random errors you are getting here are quite weird.

    Can you provide some more details on your system and usage. If I try to recreate I don’t get the random error:

    0$ ./bitcoin/src/qt/bitcoin-qt -signet --datadir=./datadir-2
    1Error: Unable to bind to 0.0.0.0:38333 on this computer. Bitcoin Core is probably already running.
    2Error: Failed to listen on any port. Use -listen=0 if you want this.
    
  5. shaavan commented at 3:19 pm on October 20, 2022: contributor

    I also tried replicating your errors, and I could not observe the segmentation fault errors. The system I used to test has the same configuration as yours.

    My system config:

    • Ubuntu 20.04
    • Qt version 5.15.3 in /usr/lib/x86_64-linux-gnu
    • Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    • SSD

    System information

    I built the bitcoin core from the git tag v24.0rc1. It’s running on a Debian Linux system, Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz, SSD.

    I am guessing, by this fact, that the issue is not caused due to the configuration of the used system.

  6. dooglus commented at 4:26 pm on October 20, 2022: contributor

    How about this?

    qt/bitcoin-qt -connect=0 -server=1 -datadir=d1
    

    That combination of options seems to provoke the crash for me every time, whereas specifying a random unused rpcport allows it to run without crashing:

    qt/bitcoin-qt -connect=0 -server=1 -datadir=d1 -rpcport=9393
  7. dooglus commented at 4:31 pm on October 20, 2022: contributor

    The crash doesn’t happen if I use bitcoind. I get a clean shutdown with bitcoind:

    $ ./bitcoind -connect=0 -server=1 -datadir=d1
    2022-10-20T16:29:41Z Bitcoin Core version v24.0.0rc2 (release build)
    2022-10-20T16:29:41Z InitParameterInteraction: parameter interaction: -connect set -> setting -dnsseed=0
    2022-10-20T16:29:41Z InitParameterInteraction: parameter interaction: -connect set -> setting -listen=0
    2022-10-20T16:29:41Z InitParameterInteraction: parameter interaction: -listen=0 -> setting -upnp=0
    2022-10-20T16:29:41Z InitParameterInteraction: parameter interaction: -listen=0 -> setting -natpmp=0
    2022-10-20T16:29:41Z InitParameterInteraction: parameter interaction: -listen=0 -> setting -discover=0
    2022-10-20T16:29:41Z InitParameterInteraction: parameter interaction: -listen=0 -> setting -listenonion=0
    2022-10-20T16:29:41Z InitParameterInteraction: parameter interaction: -listen=0 -> setting -i2pacceptincoming=0
    2022-10-20T16:29:41Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
    2022-10-20T16:29:41Z Using RdSeed as an additional entropy source
    2022-10-20T16:29:41Z Using RdRand as an additional entropy source
    2022-10-20T16:29:41Z Default data directory /home/me/.bitcoin
    2022-10-20T16:29:41Z Using data directory /home/me/Programs/bitcoin.clone/src/d1
    2022-10-20T16:29:41Z Config file: /home/me/Programs/bitcoin.clone/src/d1/bitcoin.conf (not found, skipping)
    2022-10-20T16:29:41Z Command-line arg: connect="0"
    2022-10-20T16:29:41Z Command-line arg: datadir="d1"
    2022-10-20T16:29:41Z Command-line arg: server="1"
    2022-10-20T16:29:41Z Using at most 125 automatic connections (1024 file descriptors available)
    2022-10-20T16:29:41Z Warning: relative datadir option 'd1' specified, which will be interpreted relative to the current working directory '/home/me/Programs/bitcoin.clone/src'. This is fragile, because if bitcoin is started in the future from a different location, it will be unable to locate the current data files. There could also be data loss if bitcoin is started while in a temporary directory.
    2022-10-20T16:29:41Z Using 16 MiB out of 16 MiB requested for signature cache, able to store 524288 elements
    2022-10-20T16:29:41Z Using 16 MiB out of 16 MiB requested for script execution cache, able to store 524288 elements
    2022-10-20T16:29:41Z Script verification uses 11 additional threads
    2022-10-20T16:29:41Z scheduler thread start
    2022-10-20T16:29:41Z [libevent:warning] getaddrinfo: address family for nodename not supported
    2022-10-20T16:29:41Z Binding RPC on address ::1 port 8332 failed.
    2022-10-20T16:29:41Z Binding RPC on address 127.0.0.1 port 8332 failed.
    2022-10-20T16:29:41Z Unable to bind any endpoint for RPC server
    2022-10-20T16:29:41Z Error: Unable to start HTTP server. See debug log for details.
    Error: Unable to start HTTP server. See debug log for details.
    2022-10-20T16:29:41Z Shutdown: In progress...
    2022-10-20T16:29:41Z scheduler thread exit
    2022-10-20T16:29:41Z Shutdown: done
    
  8. shaavan commented at 5:26 pm on October 20, 2022: contributor

    I was still not able to observe the error:

    Details of steps I followed to attempt to replicate:

    Step 1

    • Ran ./src/qt/bitcoin-qt -signet -datadir=/home/shaavan/.bitcoin2 -connect=0 -server=1
    • The command ran as expected, and GUI started successfully.

    Step 2:

    • Ran ./src/qt/bitcoin-qt -signet -datadir=/home/shaavan/.bitcoin3 -connect=0 -server=1
    • This crashed as expected with the message Error: Unable to start HTTP server. See debug log for details.

    The only change I have made from the suggested steps is that I have experimented on the Signet network, which I don’t think is a probable cause of the problem you are experiencing.

    Would you please share your debug.log when experiencing the “weird” errors? Maybe it can give some hints on the cause of the issue.

  9. dooglus commented at 7:53 pm on October 20, 2022: contributor

    Sure.

    $ mkdir ~/.bitcoin2
    $ mkdir ~/.bitcoin3
    $ cd ~/Programs/bitcoin.clone/src
    $ qt/bitcoin-qt -signet -datadir=/home/me/.bitcoin2 -connect=0 -server=1
    

    debug.log

    Left that running and did this in a new shell:

    $ qt/bitcoin-qt -signet -datadir=/home/me/.bitcoin3 -connect=0 -server=1
    Error: Unable to start HTTP server. See debug log for details.
    free(): double free detected in tcache 2
    Aborted
    

    debug.log

    and once more for luck:

    $ qt/bitcoin-qt -signet -datadir=/home/me/.bitcoin3 -connect=0 -server=1
    Error: Unable to start HTTP server. See debug log for details.
    Segmentation fault
    

    debug.log

  10. dooglus commented at 8:02 pm on October 20, 2022: contributor

    It also crashes without the -connect and -server flags, as follows:

    $ /bin/rm -fr ~/.bitcoin[23]
    $ mkdir ~/.bitcoin{2,3}
    $ qt/bitcoin-qt -signet -datadir=/home/me/.bitcoin2
    
    2022-10-20T20:01:15Z Bitcoin Core version v24.0.0rc2 (release build)
    2022-10-20T20:01:15Z Qt 5.15.2 (dynamic), plugin=xcb (dynamic)
    2022-10-20T20:01:15Z No static plugins.
    2022-10-20T20:01:15Z Style: fusion / QFusionStyle
    2022-10-20T20:01:15Z System: Debian GNU/Linux 11 (bullseye), x86_64-little_endian-lp64
    2022-10-20T20:01:15Z Screen: HDMI-2 1920x1080, pixel ratio=1.0
    2022-10-20T20:01:15Z Screen: eDP-1 1920x1080, pixel ratio=1.0
    2022-10-20T20:01:15Z Signet derived magic (message start): 0a03cf40
    2022-10-20T20:01:15Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
    2022-10-20T20:01:15Z Using RdSeed as an additional entropy source
    2022-10-20T20:01:15Z Using RdRand as an additional entropy source
    2022-10-20T20:01:15Z Default data directory /home/me/.bitcoin
    2022-10-20T20:01:15Z Using data directory /home/me/.bitcoin2/signet
    2022-10-20T20:01:15Z Config file: /home/me/.bitcoin2/bitcoin.conf (not found, skipping)
    2022-10-20T20:01:15Z Command-line arg: datadir="/home/me/.bitcoin2"
    2022-10-20T20:01:15Z Command-line arg: signet=""
    2022-10-20T20:01:15Z Using at most 125 automatic connections (1024 file descriptors available)
    2022-10-20T20:01:15Z Using 16 MiB out of 16 MiB requested for signature cache, able to store 524288 elements
    2022-10-20T20:01:15Z Using 16 MiB out of 16 MiB requested for script execution cache, able to store 524288 elements
    2022-10-20T20:01:15Z Script verification uses 11 additional threads
    2022-10-20T20:01:15Z scheduler thread start
    2022-10-20T20:01:15Z Using wallet directory /home/me/.bitcoin2/signet/wallets
    2022-10-20T20:01:15Z init message: Verifying wallet(s)…
    2022-10-20T20:01:15Z Using /16 prefix for IP bucketing
    2022-10-20T20:01:15Z init message: Loading P2P addresses…
    2022-10-20T20:01:15Z Creating peers.dat because the file was not found ("/home/me/.bitcoin2/signet/peers.dat")
    2022-10-20T20:01:15Z init message: Loading banlist…
    2022-10-20T20:01:15Z Recreating the banlist database
    2022-10-20T20:01:15Z SetNetworkActive: true
    2022-10-20T20:01:15Z Failed to read fee estimates from /home/me/.bitcoin2/signet/fee_estimates.dat. Continue anyway.
    2022-10-20T20:01:15Z Cache configuration:
    2022-10-20T20:01:15Z * Using 2.0 MiB for block index database
    2022-10-20T20:01:15Z * Using 8.0 MiB for chain state database
    2022-10-20T20:01:15Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
    2022-10-20T20:01:15Z init message: Loading block index…
    2022-10-20T20:01:15Z Assuming ancestors of block 000000d1a0e224fa4679d2fb2187ba55431c284fa1b74cbc8cfda866fd4d2c09 have valid signatures.
    2022-10-20T20:01:15Z Setting nMinimumChainWork=000000000000000000000000000000000000000000000000000001291fc22898
    2022-10-20T20:01:15Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
    2022-10-20T20:01:15Z Opening LevelDB in /home/me/.bitcoin2/signet/blocks/index
    2022-10-20T20:01:15Z Opened LevelDB successfully
    2022-10-20T20:01:15Z Using obfuscation key for /home/me/.bitcoin2/signet/blocks/index: 0000000000000000
    2022-10-20T20:01:15Z LoadBlockIndexDB: last block file = 0
    2022-10-20T20:01:15Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
    2022-10-20T20:01:15Z Checking all blk files are present...
    2022-10-20T20:01:15Z Initializing databases...
    2022-10-20T20:01:15Z Opening LevelDB in /home/me/.bitcoin2/signet/chainstate
    2022-10-20T20:01:16Z Opened LevelDB successfully
    2022-10-20T20:01:16Z Wrote new obfuscate key for /home/me/.bitcoin2/signet/chainstate: c306088c51f68199
    2022-10-20T20:01:16Z Using obfuscation key for /home/me/.bitcoin2/signet/chainstate: c306088c51f68199
    2022-10-20T20:01:16Z init message: Verifying blocks…
    2022-10-20T20:01:16Z  block index              15ms
    2022-10-20T20:01:16Z Setting NODE_NETWORK on non-prune mode
    2022-10-20T20:01:16Z loadblk thread start
    2022-10-20T20:01:16Z UpdateTip: new best=00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6 height=0 version=0x00000001 log2_work=22.206105 tx=1 date='2020-09-01T00:00:00Z' progress=0.000000 cache=0.0MiB(0txo)
    2022-10-20T20:01:16Z Failed to open mempool file from disk. Continuing anyway.
    2022-10-20T20:01:16Z loadblk thread exit
    2022-10-20T20:01:16Z block tree size = 1
    2022-10-20T20:01:16Z nBestHeight = 0
    2022-10-20T20:01:16Z torcontrol thread start
    2022-10-20T20:01:16Z Bound to 127.0.0.1:38334
    2022-10-20T20:01:16Z [tor] Got service ID vy7732m46ure3vpflydoenl4utpkw35feyapbckd5elbllqjhxpkvlid, advertising service vy7732m46ure3vpflydoenl4utpkw35feyapbckd5elbllqjhxpkvlid.onion:38333
    2022-10-20T20:01:16Z AddLocal(vy7732m46ure3vpflydoenl4utpkw35feyapbckd5elbllqjhxpkvlid.onion:38333,4)
    2022-10-20T20:01:16Z [net:error] Couldn't open socket for incoming connections (socket returned error Address family not supported by protocol (97))
    2022-10-20T20:01:16Z Bound to 0.0.0.0:38333
    2022-10-20T20:01:16Z 0 block-relay-only anchors will be tried for connections.
    2022-10-20T20:01:16Z init message: Starting network threads…
    2022-10-20T20:01:16Z net thread start
    2022-10-20T20:01:16Z dnsseed thread start
    2022-10-20T20:01:16Z opencon thread start
    2022-10-20T20:01:16Z init message: Done loading
    2022-10-20T20:01:16Z addcon thread start
    2022-10-20T20:01:16Z msghand thread start
    2022-10-20T20:01:16Z Loading addresses from DNS seed seed.signet.bitcoin.sprovoost.nl.
    2022-10-20T20:01:16Z GUI: Platform customization: "other"
    2022-10-20T20:01:16Z Loading addresses from DNS seed 178.128.221.177
    2022-10-20T20:01:16Z Loading addresses from DNS seed v7ajjeirttkbnt32wpy3c6w3emwnfr3fkla7hpxcfokr3ysd3kqtzmqd.onion:38333
    2022-10-20T20:01:16Z 10 addresses found from DNS seeds
    2022-10-20T20:01:16Z dnsseed thread exit
    2022-10-20T20:01:17Z New outbound peer connected: version: 70016, blocks=113272, peer=0 (outbound-full-relay)
    2022-10-20T20:01:17Z New outbound peer connected: version: 70016, blocks=113272, peer=1 (addr-fetch)
    

    Then:

    $ qt/bitcoin-qt -signet -datadir=/home/me/.bitcoin3
    Error: Unable to bind to 0.0.0.0:38333 on this computer. Bitcoin Core is probably already running.
    Error: Failed to listen on any port. Use -listen=0 if you want this.
    Segmentation fault
    

    and:

    2022-10-20T20:01:24Z Bitcoin Core version v24.0.0rc2 (release build)
    2022-10-20T20:01:24Z Qt 5.15.2 (dynamic), plugin=xcb (dynamic)
    2022-10-20T20:01:24Z No static plugins.
    2022-10-20T20:01:24Z Style: fusion / QFusionStyle
    2022-10-20T20:01:24Z System: Debian GNU/Linux 11 (bullseye), x86_64-little_endian-lp64
    2022-10-20T20:01:24Z Screen: HDMI-2 1920x1080, pixel ratio=1.0
    2022-10-20T20:01:24Z Screen: eDP-1 1920x1080, pixel ratio=1.0
    2022-10-20T20:01:25Z Signet derived magic (message start): 0a03cf40
    2022-10-20T20:01:25Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
    2022-10-20T20:01:25Z Using RdSeed as an additional entropy source
    2022-10-20T20:01:25Z Using RdRand as an additional entropy source
    2022-10-20T20:01:25Z Default data directory /home/me/.bitcoin
    2022-10-20T20:01:25Z Using data directory /home/me/.bitcoin3/signet
    2022-10-20T20:01:25Z Config file: /home/me/.bitcoin3/bitcoin.conf (not found, skipping)
    2022-10-20T20:01:25Z Command-line arg: datadir="/home/me/.bitcoin3"
    2022-10-20T20:01:25Z Command-line arg: signet=""
    2022-10-20T20:01:25Z Using at most 125 automatic connections (1024 file descriptors available)
    2022-10-20T20:01:25Z Using 16 MiB out of 16 MiB requested for signature cache, able to store 524288 elements
    2022-10-20T20:01:25Z Using 16 MiB out of 16 MiB requested for script execution cache, able to store 524288 elements
    2022-10-20T20:01:25Z Script verification uses 11 additional threads
    2022-10-20T20:01:25Z scheduler thread start
    2022-10-20T20:01:25Z Using wallet directory /home/me/.bitcoin3/signet/wallets
    2022-10-20T20:01:25Z init message: Verifying wallet(s)…
    2022-10-20T20:01:25Z Using /16 prefix for IP bucketing
    2022-10-20T20:01:25Z init message: Loading P2P addresses…
    2022-10-20T20:01:25Z Creating peers.dat because the file was not found ("/home/me/.bitcoin3/signet/peers.dat")
    2022-10-20T20:01:25Z init message: Loading banlist…
    2022-10-20T20:01:25Z Recreating the banlist database
    2022-10-20T20:01:25Z SetNetworkActive: true
    2022-10-20T20:01:25Z Failed to read fee estimates from /home/me/.bitcoin3/signet/fee_estimates.dat. Continue anyway.
    2022-10-20T20:01:25Z Cache configuration:
    2022-10-20T20:01:25Z * Using 2.0 MiB for block index database
    2022-10-20T20:01:25Z * Using 8.0 MiB for chain state database
    2022-10-20T20:01:25Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
    2022-10-20T20:01:25Z init message: Loading block index…
    2022-10-20T20:01:25Z Assuming ancestors of block 000000d1a0e224fa4679d2fb2187ba55431c284fa1b74cbc8cfda866fd4d2c09 have valid signatures.
    2022-10-20T20:01:25Z Setting nMinimumChainWork=000000000000000000000000000000000000000000000000000001291fc22898
    2022-10-20T20:01:25Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
    2022-10-20T20:01:25Z Opening LevelDB in /home/me/.bitcoin3/signet/blocks/index
    2022-10-20T20:01:25Z Opened LevelDB successfully
    2022-10-20T20:01:25Z Using obfuscation key for /home/me/.bitcoin3/signet/blocks/index: 0000000000000000
    2022-10-20T20:01:25Z LoadBlockIndexDB: last block file = 0
    2022-10-20T20:01:25Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
    2022-10-20T20:01:25Z Checking all blk files are present...
    2022-10-20T20:01:25Z Initializing databases...
    2022-10-20T20:01:25Z Opening LevelDB in /home/me/.bitcoin3/signet/chainstate
    2022-10-20T20:01:25Z Opened LevelDB successfully
    2022-10-20T20:01:25Z Wrote new obfuscate key for /home/me/.bitcoin3/signet/chainstate: e774dd3b6e1b9d5e
    2022-10-20T20:01:25Z Using obfuscation key for /home/me/.bitcoin3/signet/chainstate: e774dd3b6e1b9d5e
    2022-10-20T20:01:25Z init message: Verifying blocks…
    2022-10-20T20:01:25Z  block index              20ms
    2022-10-20T20:01:25Z Setting NODE_NETWORK on non-prune mode
    2022-10-20T20:01:25Z loadblk thread start
    2022-10-20T20:01:25Z UpdateTip: new best=00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6 height=0 version=0x00000001 log2_work=22.206105 tx=1 date='2020-09-01T00:00:00Z' progress=0.000000 cache=0.0MiB(0txo)
    2022-10-20T20:01:25Z Failed to open mempool file from disk. Continuing anyway.
    2022-10-20T20:01:25Z loadblk thread exit
    2022-10-20T20:01:25Z block tree size = 1
    2022-10-20T20:01:25Z nBestHeight = 0
    2022-10-20T20:01:25Z torcontrol thread start
    2022-10-20T20:01:25Z [net:error] Unable to bind to 127.0.0.1:38334 on this computer. Bitcoin Core is probably already running.
    2022-10-20T20:01:25Z [tor] Got service ID ia4ske4ypmkoihltthqu2gsuyzlycxkg2b6i3qgpgl66fh3ncwmiwcid, advertising service ia4ske4ypmkoihltthqu2gsuyzlycxkg2b6i3qgpgl66fh3ncwmiwcid.onion:38333
    2022-10-20T20:01:25Z AddLocal(ia4ske4ypmkoihltthqu2gsuyzlycxkg2b6i3qgpgl66fh3ncwmiwcid.onion:38333,4)
    2022-10-20T20:01:25Z [net:error] Couldn't open socket for incoming connections (socket returned error Address family not supported by protocol (97))
    2022-10-20T20:01:25Z [net:error] Unable to bind to 0.0.0.0:38333 on this computer. Bitcoin Core is probably already running.
    2022-10-20T20:01:25Z Error: Unable to bind to 0.0.0.0:38333 on this computer. Bitcoin Core is probably already running.
    2022-10-20T20:01:27Z Error: Failed to listen on any port. Use -listen=0 if you want this.
    2022-10-20T20:01:27Z tor: Thread interrupt
    2022-10-20T20:01:27Z Shutdown: In progress...
    2022-10-20T20:01:27Z RemoveLocal(ia4ske4ypmkoihltthqu2gsuyzlycxkg2b6i3qgpgl66fh3ncwmiwcid.onion:38333)
    2022-10-20T20:01:27Z torcontrol thread exit
    2022-10-20T20:01:27Z scheduler thread exit
    2022-10-20T20:01:27Z Writing 0 unbroadcast transactions to disk.
    2022-10-20T20:01:27Z Dumped mempool: 1.606e-06s to copy, 0.00638859s to dump
    2022-10-20T20:01:27Z Shutdown: done
    
  11. maflcko commented at 7:25 am on October 21, 2022: member
    Can you reproduce starting from a fresh install of the operating system? We likely need all your system libs, user compiled ones, or depends flags, as well as the compiler and configure flags to reproduce.
  12. dooglus commented at 1:33 pm on October 21, 2022: contributor
    @MarcoFalke I don’t have any spare hardware available. Would a fresh install in a virtual machine be good enough?
  13. maflcko commented at 1:35 pm on October 21, 2022: member
    Sure
  14. dooglus commented at 2:35 pm on October 21, 2022: contributor
    OK. I don’t see the crash on a fresh install in a virtual machine. I’ll try incrementally making the virtual machine closer to the real machine until the crash starts happening there - if it ever does.
  15. dooglus commented at 8:43 pm on October 21, 2022: contributor

    I was able to get a segmentation fault on a clean debian 11.5 install doing just the following commands:

    su -
    # adduser me sudo
    sudo adduser me vboxsf
    cd /media/cdrom0/
    sudo sh VBoxLinuxAdditions.run 
    sudo adduser me vboxsf
    sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 libevent-dev libboost-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools emacs-gtk git htop wget libdb5.3++ libsqlite3-dev gettext libdb5.3++-dev libqrencode4 libqrencode-dev
    cd
    git clone https://github.com/bitcoin/bitcoin.git
    cd bitcoin
    git checkout v24.0rc2
    ./autogen.sh 
    ./configure 
    cd src
    make -j 6 qt/bitcoin-qt
    mkdir ~/.bitcoin{2,3}
    ~/bitcoin/src/qt/bitcoin-qt -signet -datadir=/home/me/.bitcoin2 -server=1 -connect=0
    ~/bitcoin/src/qt/bitcoin-qt -signet -datadir=/home/me/.bitcoin3 -server=1 -connect=0
    

    I’ll try cutting down on the package list and see if the crash still happens. I probably don’t need the virtualbox guest additions or shared folder with the host machine either.

  16. dooglus commented at 10:42 pm on October 21, 2022: contributor

    OK, I made some progress.

    On a clean install of Debian 11.5, if I install the bare minimum to build bitcoin-qt, I get no crash. That’s using this command to install the packages:

    # apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 libevent-dev libboost-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools git
    

    If I then add one more package and rebuild, I get the crash:

    # apt install libsqlite3-dev
    

    So it appears that libsqlite3-dev is the culprit.

    Can someone try to reproduce the crash now?

    I’m running two bitcoin-qt processes at the same time, like this:

    $ qt/bitcoin-qt -signet -datadir=/home/me/b1 -server=1 -connect=0
    $ qt/bitcoin-qt -signet -datadir=/home/me/b2 -server=1 -connect=0
    

    after making sure that the b1 and b2 directories exist and are empty.

    Screenshot_2022-10-21_15-45-33

    In summary, here’s what I did on a clean install of debian 11.5 to reproduce the segmentation fault. I used this ISO image to install a clean copy of the OS and then ran these commands:

    su -
    apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 libevent-dev libboost-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools git
    exit
    git clone https://github.com/bitcoin/bitcoin.git
    cd bitcoin
    git checkout v24.0rc2
    ./autogen.sh 
    ./configure 
    cd src
    make -j 6 qt/bitcoin-qt
    mkdir ~/b{1,2}
    qt/bitcoin-qt -signet -datadir=/home/me/b1 -server=1 -connect=0
    qt/bitcoin-qt -signet -datadir=/home/me/b2 -server=1 -connect=0
    
    [clean exit]
    
    su -
    apt install libsqlite3-dev
    exit
    cd ~/bitcoin
    ./configure
    cd src
    make -j 6 qt/bitcoin-qt
    qt/bitcoin-qt -signet -datadir=/home/me/b1 -server=1 -connect=0
    qt/bitcoin-qt -signet -datadir=/home/me/b2 -server=1 -connect=0
    
    [segmentation fault]
    
  17. dooglus commented at 0:56 am on October 22, 2022: contributor

    Building with:

    ./configure --with-sqlite=no
    

    prevents the segmentation fault, even if package libsqlite3-dev is installed.

    And building with:

    ./configure --with-incompatible-bdb
    

    causes the segmentation fault, even if package libsqlite3-dev isn’t installed.

    It looks like the segmentation fault happens whenever #define ENABLE_WALLET 1 is in src/config/bitcoin-config.h, which happens either if sqlite3 is available, or if --with-incompatible-bdb is specified at ./configure time.

  18. dooglus commented at 1:12 am on October 22, 2022: contributor

    I tried building with both bdb and sqlite wallets enabled. Then this causes a segmentation fault if another bitcoin-qt is running:

    $ qt/bitcoin-qt -signet -datadir=/home/me/b2 -server=1 -connect=0
    

    and this doesn’t:

    $ qt/bitcoin-qt -signet -datadir=/home/me/b2 -server=1 -connect=0 -disablewallet
    

    So it appears that having any kind of wallet (bdb or sqlite) enabled at runtime is the deciding factor, not whether the wallet code is compiled in or not.

  19. hebasto commented at 9:13 am on October 24, 2022: member

    In summary, here’s what I did on a clean install of debian 11.5 to reproduce the segmentation fault. I used this ISO image to install a clean copy of the OS and then ran these commands:

    I can reproduce issue on that Debian, but not on Ubuntu 22.04.

  20. maflcko added the label Wallet on Oct 24, 2022
  21. hebasto commented at 9:20 am on October 24, 2022: member

    This issue has the same root as #25146 and https://github.com/bitcoin-core/gui/pull/604. @dooglus

    Mind checking a fix suggested in https://github.com/bitcoin-core/gui/pull/605?

  22. dooglus commented at 2:51 pm on October 25, 2022: contributor

    @hebasto Building from your 220522-splash branch fixes the crash for me. I didn’t try merging it, I just built from the end of your branch:

    0commit d2cfc7d6afad634d1debf7cdf5488f4953a975d9 (HEAD -> 220522-splash, tag: pr605.04, hebasto/220522-splash)
    1Author: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
    2Date:   Mon Oct 24 10:43:11 2022 +0100
    3
    4    qt: Delete splash screen widget in `requestShutdown()` explicitly
    

    Edit: I also tried cherry picking just that commit onto the v24.0rc2 tag:

    git checkout v24.0rc2
    git cherry-pick d2cfc7d6
    

    and that fixed the crash too.

  23. dooglus commented at 3:22 pm on October 25, 2022: contributor

    @hebasto Oh, but when I interrupt (control C) the first (~/b1/) bitcoin-qt it crashes with your fix cherry-picked in, and it didn’t before:

     0me@deb115:~$ ~/bitcoin/src/qt/bitcoin-qt-v24.0rc2 -signet -datadir=/home/me/b1
     1^C
     2me@deb115:~$ ~/bitcoin/src/qt/bitcoin-qt-v24.0rc2 -signet -datadir=/home/me/b1
     3^C
     4me@deb115:~$ ~/bitcoin/src/qt/bitcoin-qt-d2cfc7d6 -signet -datadir=/home/me/b1
     5^C
     6Segmentation fault
     7me@deb115:~$ ~/bitcoin/src/qt/bitcoin-qt-d2cfc7d6 -signet -datadir=/home/me/b1
     8^C
     9Segmentation fault
    10me@deb115:~$ 
    

    It also crashes if I hit control Q in the Qt window.

  24. dooglus commented at 3:40 pm on October 25, 2022: contributor

    Setting a breakpoint on your new delete line:

     0Thread 1 "bitcoin-qt" hit Breakpoint 7, BitcoinApplication::requestShutdown (this=0x7fffffffdae0) at qt/bitcoin.cpp:403
     1403	    delete m_splash;
     2(gdb) p m_splash
     3$2 = (SplashScreen *) 0x555557046000
     4(gdb) x m_splash
     50x555557046000:	0x5790d830
     6(gdb) n
     7
     8Thread 1 "bitcoin-qt" received signal SIGSEGV, Segmentation fault.
     90x0000000200000002 in ?? ()
    10(gdb) 
    
  25. dooglus commented at 5:02 pm on October 26, 2022: contributor
    I guess I should mention https://github.com/bitcoin-core/gui/pull/605 since that’s what caused this new crash.
  26. hebasto commented at 12:31 pm on October 27, 2022: member

    @dooglus

    Thank you for the thorough testing!

    Mind trying out the latest https://github.com/bitcoin-core/gui/pull/605?

  27. dooglus commented at 11:54 pm on November 23, 2022: contributor

    @hebasto Sorry for the delay.

    1b228497 looks good to me. I can’t get it to crash.

  28. hebasto closed this on Dec 20, 2022

  29. bitcoin locked this on Dec 20, 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: 2024-11-23 12:12 UTC

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