blocknetdx / blocknet

Official Blocknet cryptocurrency wallet
https://www.blocknet.org
MIT License
214 stars 95 forks source link

QT wallet crashed with Assertion failed: detected inconsistent lock order at sync.cpp:108, details in debug log #604

Open walkjivefly opened 2 years ago

walkjivefly commented 2 years ago

QT wallet crashed with

Assertion failed: detected inconsistent lock order at sync.cpp:108, details in debug log

shortly after loading a different wallet from the debug console.

tail debug.log showed

2021-11-17T23:02:46Z Using wallet /home/mark/.blocknet/wallets/voting
2021-11-17T23:02:46Z BerkeleyEnvironment::Open: LogDir=/home/mark/.blocknet/wallets/voting/database ErrorFile=/home/mark/.blocknet/wallets/voting/db.log
2021-11-17T23:02:47Z init message: Loading wallet...
2021-11-17T23:02:54Z UpdateTip: new best=687795fd4b778b1896e8fe8e2a54a69c8dbad89845742518bd0a7e3f6eaf8d80 height=2243935 version=0x20000000 log2_work=66.805745 tx=4906931 date='2021-11-17T23:00:24Z' progress=1.000000 cache=0.0MiB(4txo)
2021-11-17T23:02:54Z BerkeleyEnvironment::Open: LogDir=/home/mark/.blocknet/wallets/voting/database ErrorFile=/home/mark/.blocknet/wallets/voting/db.log
2021-11-17T23:02:54Z [voting] nFileVersion = 4030300
2021-11-17T23:02:54Z [voting] Keys: 2 plaintext, 0 encrypted, 2 w/ metadata, 2 total. Unknown wallet records: 0
2021-11-17T23:02:54Z [voting] Wallet completed loading in            7115ms
2021-11-17T23:02:54Z UpdateTip: new best=c8c0f182de368c28091f1006854c4c4aa0bc7b3aa56c88f13402bdc75eef6a52 height=2243936 version=0x20000000 log2_work=66.805745 tx=4906934 date='2021-11-17T23:01:29Z' progress=1.000000 cache=0.0MiB(11txo)
2021-11-17T23:02:54Z init message: Rescanning...
2021-11-17T23:02:54Z [voting] Rescanning last 49072 blocks (from block 2194864)...
2021-11-17T23:02:54Z [voting] Rescan started from block 4690b938480a9dd945afd2aac16d826aeabbb1d987baa8f776f54c5d6c928643...
2021-11-17T23:02:54Z [voting] AddToWallet xxxxxx  new
...
2021-11-17T23:02:57Z [voting] AddToWallet xxxxxx  new
2021-11-17T23:02:57Z [voting] Rescan completed in            3665ms
2021-11-17T23:02:58Z [voting] setKeyPool.size() = 0
2021-11-17T23:02:58Z [voting] mapWallet.size() = 5697
2021-11-17T23:02:58Z [voting] mapAddressBook.size() = 6
2021-11-17T23:02:58Z UpdateTip: new best=5d3f5e34ab9aa0003bc11d2c9019f52371fed46cbba4c2d25402e70842ca9666 height=2243937 version=0x20000000 log2_work=66.805746 tx=4906936 date='2021-11-17T23:02:34Z' progress=1.000000 cache=0.0MiB(15txo)
2021-11-17T23:02:58Z New outbound peer connected: version: 70713, blocks=2243937, peer=2
2021-11-17T23:02:59Z POTENTIAL DEADLOCK DETECTED
2021-11-17T23:02:59Z Previous lock order was:
2021-11-17T23:02:59Z  (1) cachedWalletMutex  qt/transactiontablemodel.cpp:185
2021-11-17T23:02:59Z  (2) cs_main  interfaces/chain.cpp:148 (TRY)
2021-11-17T23:02:59Z Current lock order is:
2021-11-17T23:02:59Z  (2) cs_main  interfaces/chain.cpp:148
2021-11-17T23:02:59Z  walletInstance->cs_wallet  wallet/wallet.cpp:4647
2021-11-17T23:02:59Z  (1) cachedWalletMutex  qt/transactiontablemodel.cpp:81

wallets/voting/db.log was empty

core dump was produced, gdb showed

Core was generated by `blocknet-qt'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007fb0f10e07bb in raise () from /lib/x86_64-linux-gnu/libc.so.6
[Current thread is 1 (Thread 0x7fafba4c6700 (LWP 28151))]
(gdb) bt
#0  0x00007fb0f10e07bb in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007fb0f10cb535 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00005555da4ffdcb in potential_deadlock_detected (mismatch={...}, 
    mismatch={...}, s2=..., s1=...) at sync.cpp:109
#3  push_lock (locklocation=..., c=<optimized out>) at sync.cpp:133
#4  EnterCritical (pszName=pszName@entry=0x5555dccd578c "cs_main", 
    pszFile=pszFile@entry=0x5555dcd57ba9 "interfaces/chain.cpp", 
    nLine=nLine@entry=148, cs=<optimized out>, fTry=fTry@entry=true)
    at sync.cpp:144
#5  0x00005555da9e9b87 in UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::TryEnter (nLine=148, 
    pszFile=0x5555dcd57ba9 "interfaces/chain.cpp", 
    pszName=0x5555dccd578c "cs_main", this=0x7fb09803c0a8) at ./sync.h:135
#6  UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock (fTry=true, nLine=148, 
    pszFile=0x5555dcd57ba9 "interfaces/chain.cpp", 
    pszName=0x5555dccd578c "cs_main", mutexIn=..., this=0x7fb09803c0a8)
    at ./sync.h:148
#7  interfaces::(anonymous namespace)::LockingStateImpl::LockingStateImpl (
    this=0x7fb09803c0a0) at interfaces/chain.cpp:140
#8  MakeUnique<interfaces::(anonymous namespace)::LockingStateImpl, AnnotatedMixin<std::recursive_mutex>&, char const (&) [8], char const (&) [21], int, bool&>
    () at ./util/memory.h:16
#9  interfaces::(anonymous namespace)::ChainImpl::lock (this=<optimized out>, 
    try_lock=<optimized out>) at interfaces/chain.cpp:148
#10 0x00005555daa31faa in interfaces::(anonymous namespace)::WalletImpl::tryGetTxStatus (this=0x7fb0cd3f2000, txid=..., tx_status=..., 
    num_blocks=@0x7fafba4c5c44: 32688, 
    block_time=@0x7fafba4c5c48: 140392721571296) at ./wallet/wallet.h:830
#11 0x00005555da69dd0a in TransactionTablePriv::index (idx=<optimized out>, 
    wallet=..., this=0x7fb0cdd7ce10) at qt/transactiontablemodel.cpp:200
#12 TransactionTableModel::index (this=this@entry=0x7fb0cdd456b0, row=5407, 
    column=column@entry=0, parent=...) at qt/transactiontablemodel.cpp:673
#13 0x00005555da69bc4f in TransactionTableModel::updateConfirmations (
    this=0x7fb0cdd456b0)
    at /usr/include/x86_64-linux-gnu/c++/8/bits/gthr-default.h:778
#14 0x00005555da617d3c in WalletModel::pollBalanceChanged (this=0x7fb0cc002430)
    at qt/walletmodel.cpp:108
#15 0x00007fb0f1341b2f in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#16 0x00007fb0f23eefa3 in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#17 0x00007fb0f11a24cf in clone () from /lib/x86_64-linux-gnu/libc.so.6

Tried again, same error occurred.

Tried starting with

blocknet-qt -wallet=voting

which succeeded and I was able to vote.

Normally I use the daemon wallet and vote through blocknet-cli but with so many proposals this month thought I'd try the QT version instead. And every month starting with (I think) the first stake after voting, the wallet crashes. The crashes continue for about 3-7 days after the superblock and then stop. There are no clues in the debug.log and I've not collected a core dump for any of them. Will be interesting to see if I get the crashes this time around.

Self-compiled v4.3.3 with debug symbols, MX-Linux 19.3.