PIVX-Project / PIVX

Protected Instant Verified Transactions - Core wallet.
https://www.pivx.org
MIT License
528 stars 715 forks source link

Crashing 2.2.0 #128

Closed ghost closed 7 years ago

ghost commented 7 years ago

OS: OSX El Capitan PIVX: 2.2.0

Crashing when trying to send obfuscated funds:

LOG _**** EXCEPTION: St13runtimeerror
CDB : Error -30974, can't open database
pivx in Runaway exception

screen shot 2017-04-19 at 10 40 46 pm
ghost commented 7 years ago

Looks similar to this error: https://github.com/bitcoin/bitcoin/issues/3993

Fuzzbawls commented 7 years ago

@lekanovic well, that issue from bitcoin was caused by a suddenly missing wallet.dat file...so, is your wallet.dat file going missing?

Regardless, you'll need to provide snippets of your debug.log file and/or db.log file

ghost commented 7 years ago

No I still have my wallet.dat, the did not have anything particular. I will reproduce the error and paste the log. The log is always safe to share, correct?

Fuzzbawls commented 7 years ago

it won't contain your private keys or wallet passphrase, may contain your IP address in various places

ghost commented 7 years ago

LOG:

2017-04-20 23:43:24 mnb - Got NEW Masternode entry - 672c78ce0ad76e4afe45e0cddd5d2f3e1996e4dbd7c323ff0668df021e74ce22 - [2001:470:1f07:144b:6cca:faff:fe99:9e3c]:51472 - CTxIn(COutPoint(e67bce789457d52ecbd6b3e63d8f7f4e4cb88099d2f2525ac9675c982effc582, 1), scriptSig=) - 1491273570 
2017-04-20 23:43:33 CommitTransaction:
CTransaction(hash=6b3bd1036c, ver=1, vin.size=11, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(6c0026081c1f2612d6fcd8d53a2890e74c6e41b9d824bf2c99cbbe7472b1036e, 1), scriptSig=304402206f3117ca12c24074)
    CTxIn(COutPoint(6c0026081c1f2612d6fcd8d53a2890e74c6e41b9d824bf2c99cbbe7472b1036e, 5), scriptSig=3044022033ab8b73c77d5f3a)
    CTxIn(COutPoint(0c0d24266ac553ee185e0dabac555e5b645db523d9d00823a1caced8ec3305a9, 5), scriptSig=3045022100c9c3b6eb916ed7)
    CTxIn(COutPoint(0c0d24266ac553ee185e0dabac555e5b645db523d9d00823a1caced8ec3305a9, 6), scriptSig=3045022100a814d40ee72201)
    CTxIn(COutPoint(0c0d24266ac553ee185e0dabac555e5b645db523d9d00823a1caced8ec3305a9, 10), scriptSig=3044022062cf97035c9c698f)
    CTxIn(COutPoint(0c0d24266ac553ee185e0dabac555e5b645db523d9d00823a1caced8ec3305a9, 12), scriptSig=3045022100b45fdc30825a17)
    CTxIn(COutPoint(0c0d24266ac553ee185e0dabac555e5b645db523d9d00823a1caced8ec3305a9, 17), scriptSig=304402203332c689682362da)
    CTxIn(COutPoint(0c0d24266ac553ee185e0dabac555e5b645db523d9d00823a1caced8ec3305a9, 19), scriptSig=30440220366c3145e2e71eb3)
    CTxIn(COutPoint(6d9f089d92efaba511652be38afc4ddb07577b76be2f85367ce47b9881cda7f0, 0), scriptSig=30450221009c699b640d1de5)
    CTxIn(COutPoint(6d9f089d92efaba511652be38afc4ddb07577b76be2f85367ce47b9881cda7f0, 1), scriptSig=304402202f755eae41851dd0)
    CTxIn(COutPoint(6d9f089d92efaba511652be38afc4ddb07577b76be2f85367ce47b9881cda7f0, 7), scriptSig=304402206d14cd71c5b9d37c)
    CTxOut(nValue=1.00000000, scriptPubKey=OP_DUP OP_HASH160 d4151c2010c7)
2017-04-20 23:43:33 GUI: Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

2017-04-20 23:43:33 

************************
EXCEPTION: St13runtime_error       
CDB : Error -30974, can't open database        
pivx in Runaway exception       
ghost commented 7 years ago

I can also mention that I have a "Obfuscation Balance" and Completion 95%, not sure if that could have any impact

Fuzzbawls commented 7 years ago

anything in your db.log file? (this is a different file from debug.log)

ghost commented 7 years ago

db.log

file wallet.dat has LSN 1/945283, past end of log at 1/333
Commonly caused by moving a database from one database environment
to another without clearing the database LSNs, or by removing all of
the log files from a database environment
DB_ENV->log_flush: LSN of 1/945283 past current end-of-log of 1/333
Database environment corrupt; the wrong log files may have been removed or incompatible database files imported from another environment
PANIC: DB_RUNRECOVERY: Fatal error, run database recovery
wallet.dat: unable to flush page: 108
txn_checkpoint: failed to flush the buffer cache: DB_RUNRECOVERY: Fatal error, run database recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
File handles still open at environment close
Open file handle: /home/radovan/.pivx/wallet.dat
Open file handle: /home/radovan/.pivx/database/log.0000000001
PANIC: fatal region error detected; run recovery
file wallet.dat has LSN 1/945283, past end of log at 1/817
Commonly caused by moving a database from one database environment
to another without clearing the database LSNs, or by removing all of
the log files from a database environment
DB_ENV->log_flush: LSN of 1/945283 past current end-of-log of 1/817
Database environment corrupt; the wrong log files may have been removed or incompatible database files imported from another environment
PANIC: DB_RUNRECOVERY: Fatal error, run database recovery
wallet.dat: unable to flush page: 108
txn_checkpoint: failed to flush the buffer cache: DB_RUNRECOVERY: Fatal error, run database recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
Fuzzbawls commented 7 years ago

Out of curiosity, is this a freshly synced or synced from scratch client? did you use a snapshot or otherwise any block data from another source?

ghost commented 7 years ago

This is a freshly synced chain, using wallet 2.2.0. I used a snapshot that was generated with version 2.1.7 but that one kept crashing. Since the 2.2.0 version had fixed the slow sync, I did a full resync

Fuzzbawls commented 7 years ago

Obfuscation may be causing issues with the pointer records in your wallet.dat file. This feature is planned for depreciation and eventual removal in the future.

I would suggest to make a NEW backup of your wallet.dat file, without deleting any previous backups, then run the wallet with the -salvagewallet option (you can also do this via the UI's Wallet Repair window, its the first button).

Be absolute certain that you have backups of your wallet.dat file before doing this.

Moving forward, I would recommend not using Obfuscation, especially during update cycles. If this feature is critical to your needs then we can spend some more time investigating the possibility of it being the cause of any issues.

ghost commented 7 years ago

I just ran that command and the wallet crashed

walletcrash

debug.log:

2017-04-21 00:18:47 dumpaddr thread stop
2017-04-21 00:18:47 addcon thread interrupt
2017-04-21 00:18:47 net thread interrupt
2017-04-21 00:18:47 PrepareShutdown: In progress...
2017-04-21 00:18:47 StopNode()
2017-04-21 00:18:47 Verifying mncache.dat format...
2017-04-21 00:18:47 ERROR: Read : Failed to open file /home/radovan/.pivx/mncache.dat
2017-04-21 00:18:47 Missing masternode cache file - mncache.dat, will try to recreate
2017-04-21 00:18:47 Writting info to mncache.dat...
2017-04-21 00:18:47 Written info to mncache.dat  50ms
2017-04-21 00:18:47   Masternodes: 1952, peers who asked us for Masternode list: 0, peers we asked for Masternode list: 5, entries in Masternode list we asked for: 1, nDsqCount: 2
2017-04-21 00:18:47 Masternode dump finished  50ms
2017-04-21 00:18:47 Verifying budget.dat format...
2017-04-21 00:18:47 ERROR: Read : Failed to open file /home/radovan/.pivx/budget.dat
2017-04-21 00:18:47 Missing budgets file - budget.dat, will try to recreate
2017-04-21 00:18:47 Writting info to budget.dat...
2017-04-21 00:18:47 Written info to budget.dat  1ms
2017-04-21 00:18:47 Budget dump finished  1ms
2017-04-21 00:18:47 Verifying mnpayments.dat format...
2017-04-21 00:18:47 ERROR: Read : Failed to open file /home/radovan/.pivx/mnpayments.dat
2017-04-21 00:18:47 Missing budgets file - mnpayments.dat, will try to recreate
2017-04-21 00:18:47 Writting info to mnpayments.dat...
2017-04-21 00:18:47 Written info to mnpayments.dat  39ms
2017-04-21 00:18:47 Budget dump finished  39ms
2017-04-21 00:18:47 *** System error while flushing: CDB : Error -30974, can't open database 

db.log

file wallet.dat has LSN 1/945283, past end of log at 1/333
Commonly caused by moving a database from one database environment
to another without clearing the database LSNs, or by removing all of
the log files from a database environment
DB_ENV->log_flush: LSN of 1/945283 past current end-of-log of 1/333
Database environment corrupt; the wrong log files may have been removed or incompatible database files imported from another environment
PANIC: DB_RUNRECOVERY: Fatal error, run database recovery
wallet.dat: unable to flush page: 108
txn_checkpoint: failed to flush the buffer cache: DB_RUNRECOVERY: Fatal error, run database recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
ghost commented 7 years ago

Obfuscation is not important to me, it's just that I have quite many PIV locked down in the Obfuscation Balance, and I really like to move them out from that obfuscation balance to another address.

BTW is it safe to run the "Reset" button under Obfuscation? will that make the funds to move back to normal balance?

Fuzzbawls commented 7 years ago

Restore your previous wallet.dat backup and stop Obfuscation for now. Going to get someone else to address how best to go about getting coins out of your Obfuscation balance and back into normal play.

There does seem to be some corruption within your wallet.dat file, so it would be a good idea to go through each address you have a balance in and export it's private key. you can use the RPC Console to do this:

dumpprivkey <PIVX_Address>

It may become necessary to rebuild your wallet.dat file manually, so have each private key saved somewhere safe (encrypted text file or USB key would be best, but even on a piece of paper is better than nothing)

Fuzzbawls commented 7 years ago

If you have not yet done so, enable coin control features to quickly see all of the addresses you currently have a balance in

ghost commented 7 years ago

I only have one address, because I am using BIP38. The thing I don't understand is when I use the blockexplorer to check the funds of my BIP38 address it does not show the obfuscated balance. Are those funds stored in a different address ?

ghost commented 7 years ago

@Fuzzbawls Thanks for helping out, I was able to move all of my obfuscated funds back to the normal balance. The way I did it was by enabling "coin control features" as you suggested and then move all the funds to the one address I am using. I would suggest that you disable obfuscation in the next release since it's not very stable, and people might end up in the same situation as I did

Anyway thanks again!

Fuzzbawls commented 7 years ago

@lekanovic glad you were able to consolidate your coins into one address and free up those that were in Obfuscation balance.

You may want to, just for the sake of data consistency, consider recreating a fresh wallet.dat file and importing your existing private key. As long as your coins are associated with the same address, and you have that address' private key, this can be done at any time.

Fuzzbawls commented 7 years ago

closing now due to resolution. if this issue pops up again comment further for reopening.