decred / dcrwallet

A secure Decred wallet daemon written in Go (golang).
https://decred.org
ISC License
216 stars 155 forks source link

deserializeSStxRecord - panic: runtime error: makeslice: len out of range #695

Closed meany closed 7 years ago

meany commented 7 years ago

after upgrading to 1.0.1 on my stake server, received the following error. i also run a very vanilla node with no balance that upgraded to 1.0.1 just fine.

goroutine 1 [running]:
panic(0xaec0e0, 0xc42000dac0)
/home/jcv/code/golang/src/runtime/panic.go:500 +0x1a1
github.com/decred/dcrwallet/wallet/udb.deserializeSStxRecord(0x7fc87914b2fa, 0x189, 0x189, 0x2, 0x7fc87914b2fa, 0x189, 0x189)
/home/jcv/code/go/src/github.com/decred/dcrwallet/wallet/udb/stakedb.go:124 +0x40d
github.com/decred/dcrwallet/wallet/udb.fetchSStxRecord(0x7fc887008eb8, 0xc42016fd40, 0xc420180ce0, 0x7fc800000002, 0xc42016fd40, 0x189, 0x189)
/home/jcv/code/go/src/github.com/decred/dcrwallet/wallet/udb/stakedb.go:562 +0xd4
github.com/decred/dcrwallet/wallet/udb.votingPreferencesUpgrade(0x1099ee0, 0xc42001e1c0, 0xc420107320, 0x24, 0x30, 0x0, 0x0)
/home/jcv/code/go/src/github.com/decred/dcrwallet/wallet/udb/upgrades.go:246 +0x319
github.com/decred/dcrwallet/wallet/udb.Upgrade.func2(0x1099ee0, 0xc42001e1c0, 0xc42001e1c0, 0x0)
/home/jcv/code/go/src/github.com/decred/dcrwallet/wallet/udb/upgrades.go:302 +0xac
github.com/decred/dcrwallet/walletdb.Update(0x1098040, 0xc4204a0780, 0xc4204e5990, 0x0, 0x0)
/home/jcv/code/go/src/github.com/decred/dcrwallet/walletdb/interface.go:219 +0x6f
github.com/decred/dcrwallet/wallet/udb.Upgrade(0x1098040, 0xc4204a0780, 0xc420107320, 0x24, 0x30, 0xc420413e10, 0xc420413e00)
/home/jcv/code/go/src/github.com/decred/dcrwallet/wallet/udb/upgrades.go:308 +0x275
github.com/decred/dcrwallet/wallet.Open(0x1098040, 0xc4204a0780, 0xc420107320, 0x24, 0x30, 0x1000101, 0xc42041c60e, 0x23, 0xc4204f3b9c, 0x23, ...)
/home/jcv/code/go/src/github.com/decred/dcrwallet/wallet/wallet.go:3720 +0xf8
github.com/decred/dcrwallet/loader.(*Loader).OpenExistingWallet(0xc42049c820, 0xc420107320, 0x24, 0x30, 0x1, 0x0, 0x0, 0x0)
/home/jcv/code/go/src/github.com/decred/dcrwallet/loader/loader.go:219 +0x477
main.walletMain(0x0, 0x0)
/home/jcv/code/go/src/github.com/decred/dcrwallet/dcrwallet.go:126 +0x76e
main.main()
/home/jcv/code/go/src/github.com/decred/dcrwallet/dcrwallet.go:38 +0x32
jrick commented 7 years ago

Ok i'm investigating this and it looks like faulty db logic was added a long time ago. The data being read in this case was removed in a newer version of the DB but the old logic still needs to be fixed. I will add a workaround for this.

Are you able to build from source? If so would be you be willing to try a patch?

jrick commented 7 years ago

Another question, do you happen to remember what version you first used to create this particular wallet?

meany commented 7 years ago

certainly willing to help and can build from source - i have had this wallet for a very long time (i was part of the airdrop) and perhaps it's time to move my funds into the new vanilla wallet (started with 0.8.2)

jrick commented 7 years ago

Ok, you can do that as a workaround for now but please keep the old db around to test my patch later :)

meany commented 7 years ago

you got it, let me know when it's ready