macOS: crash while loading wallet with berkeley-db@4 #15819

issue Sjors openend this issue on April 15, 2019
  1. Sjors commented at 1:36 pm on April 15, 2019: member

    On macOS 10.14.4 with Homebrew berkeley-db@4 4.8.30 using master (4f4ef3138b06b405d9d8877ddc4a3492a2512c41) bitcoind crashes when loading an existing wallet or creating a new one.

     02019-04-15T10:28:15Z init message: Verifying wallet(s)...
     12019-04-15T10:28:15Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
     22019-04-15T10:28:15Z Using wallet /Users/bitcoin/Library/Application Support/Bitcoin/testnet3/wallets/A
     32019-04-15T10:28:15Z BerkeleyEnvironment::Open: LogDir=/Users/bitcoin/Library/Application Support/Bitcoin/testnet3/wallets/A/database ErrorFile=/Users/bitcoin/Library/Application Support/Bitcoin/testnet3/wallets/A/db.log
     4Process 87520 stopped
     5* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10000)
     6    frame [#0](/bitcoin-bitcoin/0/): 0x0000000102445d8e libdb_cxx-4.8.dylib`__lock_get_lk_max_locks + 53
     7libdb_cxx-4.8.dylib`__lock_get_lk_max_locks:
     8->  0x102445d8e <+53>: movl   %eax, (%rsi)
     9    0x102445d90 <+55>: xorl   %eax, %eax
    10    0x102445d92 <+57>: popq   %rbp
    11    0x102445d93 <+58>: retq
    12Target 0: (bitcoind) stopped.
    13(lldb) bt
    14* thread [#1](/bitcoin-bitcoin/1/), queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10000)
    15  * frame [#0](/bitcoin-bitcoin/0/): 0x0000000102445d8e libdb_cxx-4.8.dylib`__lock_get_lk_max_locks + 53
    16    frame [#1](/bitcoin-bitcoin/1/): 0x00000001023c4afa libdb_cxx-4.8.dylib`DbEnv::get_lk_max_locks(unsigned int*) + 46
    17    frame [#2](/bitcoin-bitcoin/2/): 0x0000000100458dbf bitcoind`BerkeleyEnvironment::Open(this=<unavailable>, retry=<unavailable>) at db.cpp:195:12 [opt]
    18    frame [#3](/bitcoin-bitcoin/3/): 0x000000010045abab bitcoind`BerkeleyBatch::VerifyEnvironment(file_path=<unavailable>, errorStr="") at db.cpp:417:15 [opt]
    19    frame [#4](/bitcoin-bitcoin/4/): 0x00000001004fb295 bitcoind`CWallet::Verify(chain=0x0000000102a02990, location=0x00007ffeefbfed50, salvage_wallet=false, error_string="", warning_string=<unavailable>) at wallet.cpp:3972:14 [opt]
    20    frame [#5](/bitcoin-bitcoin/5/): 0x0000000100477628 bitcoind`VerifyWallets(chain=0x0000000102a02990, wallet_files=<unavailable>) at load.cpp:56:31 [opt]
    21    frame [#6](/bitcoin-bitcoin/6/): 0x00000001000727b9 bitcoind`AppInitMain(interfaces=<unavailable>) at init.cpp:1321:22 [opt]
    22    frame [#7](/bitcoin-bitcoin/7/): 0x0000000100004592 bitcoind`AppInit(argc=<unavailable>, argv=0x00007ffeefbff418) at bitcoind.cpp:171:16 [opt]
    23    frame [#8](/bitcoin-bitcoin/8/): 0x0000000100004042 bitcoind`main(argc=<unavailable>, argv=<unavailable>) at bitcoind.cpp:201:13 [opt]
    24    frame [#9](/bitcoin-bitcoin/9/): 0x00007fff7edfc3d5 libdyld.dylib`start + 1
    25    frame [#10](/bitcoin-bitcoin/10/): 0x00007fff7edfc3d5 libdyld.dylib`start + 1
    26(lldb)
    

    The crash does not happen when using depends. It also does not happen with a more recent BDB version using --with-incompatible-bdb (this requires uninstalling berkeley-db@4).

  2. fanquake added the label macOS on Apr 15, 2019
  3. Sjors commented at 1:39 pm on April 15, 2019: member
    If nobody can reproduce this, I might try nuking and reinstalling Homebrew entirely.
  4. MarcoFalke commented at 1:48 pm on April 15, 2019: member
    I presume the functional tests (and unit tests?) fail?
  5. laanwj added the label Upstream on Apr 15, 2019
  6. Sjors commented at 1:57 pm on April 15, 2019: member

    I should add: I can run with -nowallet without a crash (until I load a wallet).

    Functional tests fail. Most unit tests pass, but the PSBT one threw an error last time I tried.

  7. fanquake commented at 8:29 am on April 16, 2019: member

    I’d be a bit surprised if the brew installed berkeley-db@4 was the sole cause of this issue (fwiw I’m not seeing any issues with it and master). That formula has only changed a couple times over the last few years.

    The most recent change was to fix compiling with Xcode 10, which is just applying this patch. That patch is equivalent to what we apply in depends, and that we download in contrib/install_db4.sh.

    Is it possible that you’ve (re)installed berkeley-db@4, or compiled with outdated Xcode/command line tools/macOS headers installed, and that could be the cause of the issue?

    Do you have a copy of that A env that others could test with?

    If nobody can reproduce this, I might try nuking and reinstalling Homebrew entirely.

    I’d hold off on doing that (unless you have an easy way to reset to your current installed packages etc). What’s the output of brew doctor? Can you try completely removing and installing berkeley-db@4 and check if the issue persists?

  8. Sjors commented at 11:40 am on April 16, 2019: member

    I don’t think wallet A is interesting (though there’s a good chance it was created with a newer BDB version), because it also crashed when creating a fresh wallet.

    I also don’t think berkeley-db@4 the sole cause. I tried removing and reinstalling berkeley-db@4 (though not berkeley-db yet). I also didn’t try older versions of master, so it’s not even certain that anything there caused it.

    brew doctor doesn’t show seem interesting, but here it is.

    The other strange thing is that when I remove berkeley-db@4 and use --with-incompatible-bdb the following doesn’t go away: CPPFLAGS -I/usr/local/Cellar/berkeley-db@4. That directory is empty. I tried both make distclean and git clean -dfx with no effect.

  9. Sjors commented at 9:44 am on April 24, 2019: member

    I reinstalled all of Homebrew and also used berkeley-db4 (as specified in the docs) instead of berkeley-db@4. This results in a slightly different CPPFLAGS -I/usr/local/opt/berkeley-db@4/include. No more crash.

    The macOS build instructions also specify berkeley-db4. I can’t remember what the reason was that I switched to berkeley-db@4.

  10. Sjors closed this on Apr 24, 2019

  11. jingzhehu commented at 7:42 pm on May 10, 2019: none

    I run into the same problems as Sjors - make check producing errors

    fatal error: in “psbt_wallet_tests/psbt_updater_test”: memory access violation at address: 0x02800000: no mapping at fault address

    After I did brew uninstall berkeley-db; brew reinstall berkeley-db4 and ./autogen.sh && ./configure --without-gui && make -j16, the make check -j16 part passed without error.

  12. jakeleventhal commented at 6:45 am on July 31, 2020: contributor

    Seeing this same issue on the new Big Sur beta 3 for OS X

     0configure: WARNING: NO SHARED LATCH IMPLEMENTATION FOUND FOR THIS PLATFORM.
     1configure: error: Unable to find a mutex implementation
     2
     3Do not report this issue to Homebrew/brew or Homebrew/core!
     4
     5
     6Error: You are using macOS 11.0.
     7We do not provide support for this pre-release version.
     8You will encounter build failures with some formulae.
     9Please create pull requests instead of asking for help on Homebrew's GitHub,
    10Discourse, Twitter or IRC. You are responsible for resolving any issues you
    11experience while you are running this pre-release version.
    
  13. Sjors commented at 5:05 pm on July 31, 2020: member
    @jakeleventhal let’s move that to #19406 or #19411; this is a different issue.
  14. MarcoFalke 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: 2024-12-18 21:12 UTC

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